Skip to content

Commit

Permalink
Merge pull request #2247 from siemens/fix/lastModeratorMsg
Browse files Browse the repository at this point in the history
fix(mod): show message when only moderator choose remove me option

Reviewed by: hoang2.nguyenthai@toshiba.co.jp
Tested by: anupam.ghosh@siemens.com
  • Loading branch information
ag4ums authored Dec 24, 2023
2 parents a9d37d9 + ef83441 commit e6ccf98
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,7 @@ public class PortalConstants {
public static final String ACTION_POSTPONE = "action_postpone";
public static final String ACTION_DECLINE = "action_decline";
public static final String ACTION_REMOVEME = "action_removeme";
public static final String LAST_MODERATOR = "last_moderator";
public static final String ACTION_RENDER_NEXT_AFTER_UNSUBSCRIBE = "action_render_next";
public static final String MODERATION_REQUEST_COMMENT = "moderation_request_comment";
public static final String MODERATION_DECISION_COMMENT = "moderation_decision_comment";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ private void renderActionView(RenderRequest request, RenderResponse response) th
sessionMessage = LanguageUtil.get(resourceBundle,"you.have.postponed.the.previous.moderation.request");
} else if (ACTION_RENDER_NEXT_AFTER_UNSUBSCRIBE.equals(action)) {
sessionMessage = LanguageUtil.get(resourceBundle,"you.are.removed.from.the.list.of.moderators.for.the.previous.moderation.request");
} else {
} else if (LAST_MODERATOR.equals(action)) {
sessionMessage = LanguageUtil.get(resourceBundle,"you.are.the.last.moderator.for.this.request.you.are.not.allowed.to.unsubscribe");
} else {
throw new PortletException("Unknown action");
}

Expand Down Expand Up @@ -655,6 +657,12 @@ private void renderNextModeration(RenderRequest request, RenderResponse response
return;
}

if (LAST_MODERATOR.equals(request.getParameter(ACTION))) {
SessionMessages.add(request, "request_processed", sessionMessage);
renderStandardView(request, response);
return;
}

List<ModerationRequest> requestsByModerator = client.getRequestsByModerator(user);
List<ModerationRequest> openModerationRequests = requestsByModerator
.stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ require(['jquery'], function($) {
window.location = portletURL.toString();
}
else if (data.result == 'LAST_MODERATOR') {
$.alert('<liferay-ui:message key="you.are.the.last.moderator.for.this.request.you.are.not.allowed.to.unsubscribe" />');
var portletUrl = getBaseURL().setParameter('<%=PortalConstants.ACTION%>', '<%=PortalConstants.LAST_MODERATOR%>');
window.location = portletUrl.toString();
}
else {
$.alert('<liferay-ui:message key="updating.the.moderation.request.failed" />');
Expand Down

0 comments on commit e6ccf98

Please sign in to comment.