Skip to content

Commit

Permalink
CLDR-11368 Enable Forum posting by TC even when read-only (unicode-or…
Browse files Browse the repository at this point in the history
…g#2754)

-Revise SurveyForum.userCanUsePostType, isPhaseReadonly only matters for non-TC

-Refactor with boolean isTC to avoid calling userIsTC repeatedly
  • Loading branch information
btangmu authored and srl295 committed Mar 1, 2023
1 parent 2cca2ef commit 3a174c0
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,14 @@ private void gatherUsersInterestedInThread(PostInfo postInfo, User currentUser,
* @return true or false
*/
private boolean userCanUsePostType(PostInfo postInfo) {
if (SurveyMain.isPhaseReadonly()) {
User user = postInfo.getUser();
boolean isTC = UserRegistry.userIsTC(user);
if (!isTC && SurveyMain.isPhaseReadonly()) {
return false;
}
int replyTo = postInfo.getReplyTo();
PostType postType = postInfo.getType();
User user = postInfo.getUser();
if (postType == PostType.DISCUSS && replyTo == NO_PARENT && !UserRegistry.userIsTC(user)) {
if (postType == PostType.DISCUSS && replyTo == NO_PARENT && !isTC) {
return false; // only TC can initiate Discuss; others can reply
}
if (postType != PostType.CLOSE) {
Expand All @@ -290,7 +291,7 @@ private boolean userCanUsePostType(PostInfo postInfo) {
if (getUserId(postInfo.getRoot()) == user.id) {
return true;
}
return UserRegistry.userIsTC(user);
return isTC;
}

/**
Expand Down

0 comments on commit 3a174c0

Please sign in to comment.