Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* SWC-7152, SWC-7151

* fix typo
  • Loading branch information
jay-hodgson authored Nov 13, 2024
1 parent 68d5978 commit 5a1ac91
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 43 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<webappDirectory>
${project.build.directory}/${project.build.finalName}
</webappDirectory>
<synapse.version>514.0</synapse.version>
<synapse.version>521.0</synapse.version>
<gwtVersion>2.11.0</gwtVersion>
<org.springframework.version>5.3.37</org.springframework.version>
<guiceVersion>6.0.0</guiceVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
import org.sagebionetworks.web.client.widget.login.LoginWidget;
import org.sagebionetworks.web.client.widget.profile.ProfileCertifiedValidatedWidget;
import org.sagebionetworks.web.client.widget.profile.UserProfileWidget;
import org.sagebionetworks.web.client.widget.projectdataavailability.ProjectDataAvailability;
import org.sagebionetworks.web.client.widget.provenance.v2.ProvenanceWidget;
import org.sagebionetworks.web.client.widget.refresh.DiscussionThreadCountAlert;
import org.sagebionetworks.web.client.widget.refresh.EntityRefreshAlert;
Expand Down Expand Up @@ -900,4 +901,5 @@ public interface PortalGinInjector extends Ginjector {
TrustCenterPresenter getTrustCenterPresenter();
ChatPresenter getChatPresenter();
PlansPresenter getPlansPresenter();
ProjectDataAvailability getProjectDataAvailability();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

@RemoteServiceRelativePath("users")
public interface UserAccountService extends RemoteService {
void signTermsOfUse(String accessToken) throws RestServiceException;

void createUserStep1(NewUser newUser, String portalEndpoint)
throws RestServiceException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import org.sagebionetworks.web.shared.PublicPrincipalIds;

public interface UserAccountServiceAsync {
void signTermsOfUse(String accessToken, AsyncCallback<Void> callback);

void createUserStep1(
NewUser newUser,
String portalEndpoint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ void initializeFromExistingAccessTokenCookie(
*/
public UserProfile getCurrentUserProfile();

/**
* Signs the terms of use for a user
*/
public void signTermsOfUse(AsyncCallback<Void> callback);

public void updateCachedProfile(UserProfile updatedProfile);

void checkForUserChange();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,6 @@ public String getCurrentUserAccessToken() {
return currentUserAccessToken;
}

@Override
public void signTermsOfUse(AsyncCallback<Void> callback) {
userAccountService.signTermsOfUse(getCurrentUserAccessToken(), callback);
}

@Override
public void checkForUserChange() {
checkForUserChange(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.sagebionetworks.web.client.widget.entity.controller.EntityActionControllerImpl;
import org.sagebionetworks.web.client.widget.entity.menu.v3.Action;
import org.sagebionetworks.web.client.widget.entity.menu.v3.EntityActionMenu;
import org.sagebionetworks.web.client.widget.projectdataavailability.ProjectDataAvaiilability;
import org.sagebionetworks.web.client.widget.projectdataavailability.ProjectDataAvailability;

public class EntityMetadata {

Expand All @@ -40,7 +40,7 @@ public class EntityMetadata {
private final SynapseJSNIUtils jsni;
private final PortalGinInjector ginInjector;
private final EntityModalWidget entityModalWidget;
private ProjectDataAvaiilability projectDataAvailabilityWidget;
private ProjectDataAvailability projectDataAvailabilityWidget;
private boolean annotationsAreVisible = false;

@Inject
Expand All @@ -50,19 +50,16 @@ public EntityMetadata(
SynapseJavascriptClient jsClient,
SynapseJSNIUtils jsni,
PortalGinInjector ginInjector,
EntityModalWidget entityModalWidget,
ProjectDataAvaiilability projectDataAvailabilityWidget
EntityModalWidget entityModalWidget
) {
this.view = view;
this.doiWidgetV2 = doiWidgetV2;
this.jsClient = jsClient;
this.jsni = jsni;
this.ginInjector = ginInjector;
this.entityModalWidget = entityModalWidget;
this.projectDataAvailabilityWidget = projectDataAvailabilityWidget;
this.view.setDoiWidget(doiWidgetV2);
this.view.setEntityModalWidget(entityModalWidget);
this.view.setProjectDataAvailabilityWidget(projectDataAvailabilityWidget);
}

public Widget asWidget() {
Expand All @@ -77,6 +74,15 @@ public VersionHistoryWidget getVersionHistoryWidget() {
return versionHistoryWidget;
}

public ProjectDataAvailability getProjectDataAvailabilityWidget() {
if (projectDataAvailabilityWidget == null) {
this.projectDataAvailabilityWidget =
ginInjector.getProjectDataAvailability();
this.view.setProjectDataAvailabilityWidget(projectDataAvailabilityWidget);
}
return projectDataAvailabilityWidget;
}

public void configure(
EntityBundle bundle,
Long versionNumber,
Expand Down Expand Up @@ -131,7 +137,7 @@ public void configure(
}
configureStorageLocation(en);

projectDataAvailabilityWidget.setProjectId(en.getId());
getProjectDataAvailabilityWidget().setProjectId(en.getId());
// An unversioned DOI may not have been included in the (versioned) entity bundle, so we should see if one exists
if (
bundle.getDoiAssociation() == null && // If a versioned DOI exists, we should show that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;

public class ProjectDataAvaiilability implements IsWidget {
public class ProjectDataAvailability implements IsWidget {

ProjectDataAvailabilityView view;

@Inject
public ProjectDataAvaiilability(ProjectDataAvailabilityView view) {
public ProjectDataAvailability(ProjectDataAvailabilityView view) {
this.view = view;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.sagebionetworks.web.client.widget.projectdataavailability;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import org.sagebionetworks.web.client.context.SynapseReactClientFullContextPropsProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,6 @@ private void validateService() {
}
}

@Override
public void signTermsOfUse(String accessToken) throws RestServiceException {
validateService();

SynapseClient synapseClient = createSynapseClient();
try {
synapseClient.signTermsOfUse(accessToken);
} catch (SynapseException e) {
throw ExceptionUtil.convertSynapseException(e);
}
}

@Override
public void createUserStep1(NewUser newUser, String portalEndpoint)
throws RestServiceException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
import org.sagebionetworks.web.client.widget.entity.*;
import org.sagebionetworks.web.client.widget.entity.menu.v3.EntityActionMenu;
import org.sagebionetworks.web.client.widget.entity.restriction.v2.RestrictionWidget;
import org.sagebionetworks.web.client.widget.projectdataavailability.ProjectDataAvaiilability;
import org.sagebionetworks.web.client.widget.projectdataavailability.ProjectDataAvailability;
import org.sagebionetworks.web.test.helper.AsyncMockStubber;

@RunWith(MockitoJUnitRunner.Silent.class)
Expand Down Expand Up @@ -84,7 +84,7 @@ public class EntityMetadataTest {
EntityModalWidget mockEntityModalWidget;

@Mock
ProjectDataAvaiilability mockProjectDataAvaiilability;
ProjectDataAvailability mockProjectDataAvailability;

String entityId = "syn123";
String entityName = "testEntity";
Expand All @@ -96,6 +96,8 @@ public class EntityMetadataTest {
public void before() {
when(mockGinInjector.getVersionHistoryWidget())
.thenReturn(mockFileHistoryWidget);
when(mockGinInjector.getProjectDataAvailability())
.thenReturn(mockProjectDataAvailability);
when(mockGinInjector.getCookieProvider()).thenReturn(mockCookies);
widget =
new EntityMetadata(
Expand All @@ -104,8 +106,7 @@ public void before() {
mockJsClient,
mockJSNI,
mockGinInjector,
mockEntityModalWidget,
mockProjectDataAvaiilability
mockEntityModalWidget
);
}

Expand Down Expand Up @@ -138,7 +139,7 @@ public void testSetEntityBundleProject() {
widget.configure(bundle, null, mockActionMenuWidget);
verify(mockView).setDetailedMetadataVisible(true);
verify(mockDoiWidgetV2).configure(mockDoiAssociation);
verify(mockProjectDataAvaiilability).setProjectId(entityId);
verify(mockProjectDataAvailability).setProjectId(entityId);
}

@Test
Expand All @@ -165,7 +166,7 @@ public void testSetEntityBundleProjectInAlphaMode() {
widget.configure(bundle, null, mockActionMenuWidget);
verify(mockView).setDetailedMetadataVisible(true);
verify(mockDoiWidgetV2).configure(mockDoiAssociation);
verify(mockProjectDataAvaiilability).setProjectId(entityId);
verify(mockProjectDataAvailability).setProjectId(entityId);
}

@Test
Expand Down

0 comments on commit 5a1ac91

Please sign in to comment.