From 3a174c088ba81fb7f895a5de958c56146d29fd81 Mon Sep 17 00:00:00 2001 From: Tom Bishop Date: Tue, 28 Feb 2023 13:52:52 -0500 Subject: [PATCH] CLDR-11368 Enable Forum posting by TC even when read-only (#2754) -Revise SurveyForum.userCanUsePostType, isPhaseReadonly only matters for non-TC -Refactor with boolean isTC to avoid calling userIsTC repeatedly --- .../src/main/java/org/unicode/cldr/web/SurveyForum.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyForum.java b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyForum.java index 8b78606a5d3..3e4183f3b74 100644 --- a/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyForum.java +++ b/tools/cldr-apps/src/main/java/org/unicode/cldr/web/SurveyForum.java @@ -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) { @@ -290,7 +291,7 @@ private boolean userCanUsePostType(PostInfo postInfo) { if (getUserId(postInfo.getRoot()) == user.id) { return true; } - return UserRegistry.userIsTC(user); + return isTC; } /**