Skip to content

Commit

Permalink
Merge pull request #5486 from jay-hodgson/SWC-7021
Browse files Browse the repository at this point in the history
  • Loading branch information
nickgros committed Aug 13, 2024
2 parents 75531e5 + 1813a56 commit 7b3b8cb
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 87 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,19 @@ public interface Callback2 {
void run(String targetHref);
}

public Callback reportViolationCallback;
public Callback2 gotoPlace;

@JsOverlay
public static SynapseFooterProps create(
String portalVersion,
String srcVersion,
String repoVersion,
Callback reportViolationCallback,
Callback2 gotoPlace
) {
SynapseFooterProps props = new SynapseFooterProps();
props.portalVersion = portalVersion;
props.srcVersion = srcVersion;
props.repoVersion = repoVersion;
props.reportViolationCallback = reportViolationCallback;
props.gotoPlace = gotoPlace;
return props;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,32 +79,4 @@ public Widget asWidget() {
public void refresh() {
view.refresh();
}

@Override
public void onReportAbuseClicked() {
// report abuse via Jira issue collector
String userId = WebConstants.ANONYMOUS, email =
WebConstants.ANONYMOUS, displayName = WebConstants.ANONYMOUS;
UserProfile userProfile = authController.getCurrentUserProfile();
if (userProfile != null) {
userId = userProfile.getOwnerId();
displayName = DisplayUtils.getDisplayName(userProfile);
email = DisplayUtils.getPrimaryEmail(userProfile);
}

jsniUtils.showJiraIssueCollector(
"", // summary
FLAG_ISSUE_DESCRIPTION_PART_1 +
gwt.getCurrentURL() +
WebConstants.FLAG_ISSUE_DESCRIPTION_PART_2, // description
FLAG_ISSUE_COLLECTOR_URL,
userId,
displayName,
email,
null, // Synapse data object ID
REVIEW_ABUSIVE_CONTENT_REQUEST_COMPONENT_ID,
null, // Access requirement ID
FLAG_ISSUE_PRIORITY
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ public interface FooterView extends IsWidget {
/**
* Presenter interface
*/
public interface Presenter {
void onReportAbuseClicked();
}
public interface Presenter {}

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ public void refresh() {
portalVersion,
srcVersion,
repoVersion,
() -> {
presenter.onReportAbuseClicked();
},
href -> {
GlobalApplicationState globalAppState =
ginInjector.getGlobalApplicationState();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.sagebionetworks.web.shared.WebConstants.ANONYMOUS;
import static org.sagebionetworks.web.shared.WebConstants.FLAG_ISSUE_COLLECTOR_URL;
import static org.sagebionetworks.web.shared.WebConstants.FLAG_ISSUE_DESCRIPTION_PART_1;
import static org.sagebionetworks.web.shared.WebConstants.FLAG_ISSUE_PRIORITY;
import static org.sagebionetworks.web.shared.WebConstants.REVIEW_ABUSIVE_CONTENT_REQUEST_COMPONENT_ID;

import com.google.gwt.user.client.rpc.AsyncCallback;
import java.util.Collections;
Expand All @@ -19,15 +14,13 @@
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.sagebionetworks.repo.model.UserProfile;
import org.sagebionetworks.web.client.DisplayUtils;
import org.sagebionetworks.web.client.GWTWrapper;
import org.sagebionetworks.web.client.GlobalApplicationState;
import org.sagebionetworks.web.client.SynapseJSNIUtils;
import org.sagebionetworks.web.client.security.AuthenticationController;
import org.sagebionetworks.web.client.widget.footer.Footer;
import org.sagebionetworks.web.client.widget.footer.FooterView;
import org.sagebionetworks.web.client.widget.footer.VersionState;
import org.sagebionetworks.web.shared.WebConstants;
import org.sagebionetworks.web.test.helper.AsyncMockStubber;

@RunWith(MockitoJUnitRunner.class)
Expand Down Expand Up @@ -117,47 +110,4 @@ public void testAsWidget() {
footer.asWidget();
verify(mockView).asWidget();
}

@Test
public void testOnReportAbuse() {
when(mockAuthController.getCurrentUserProfile())
.thenReturn(mockUserProfile);
footer.onReportAbuseClicked();
verify(mockJsniUtils)
.showJiraIssueCollector(
"", // summary
FLAG_ISSUE_DESCRIPTION_PART_1 +
CURRENT_URL +
WebConstants.FLAG_ISSUE_DESCRIPTION_PART_2, // description
FLAG_ISSUE_COLLECTOR_URL,
OWNER_ID,
DisplayUtils.getDisplayName(FIRST_NAME, LAST_NAME, USERNAME),
EMAIL,
null, // Synapse data object ID
REVIEW_ABUSIVE_CONTENT_REQUEST_COMPONENT_ID,
null, // Access requirement ID
FLAG_ISSUE_PRIORITY
);
}

@Test
public void testOnReportAbuseAnonymous() {
// current user profile is null
footer.onReportAbuseClicked();
verify(mockJsniUtils)
.showJiraIssueCollector(
"", // summary
FLAG_ISSUE_DESCRIPTION_PART_1 +
CURRENT_URL +
WebConstants.FLAG_ISSUE_DESCRIPTION_PART_2, // description
FLAG_ISSUE_COLLECTOR_URL,
ANONYMOUS,
ANONYMOUS,
ANONYMOUS,
null, // Synapse data object ID
REVIEW_ABUSIVE_CONTENT_REQUEST_COMPONENT_ID,
null, // Access requirement ID
FLAG_ISSUE_PRIORITY
);
}
}

0 comments on commit 7b3b8cb

Please sign in to comment.