A platform for community discussion. Free, open, simple.
FIX: Review sidebar link showing for users that can't review (#18454)
Alan Guo Xiang Tanc5544a762401
diff --git a/app/assets/javascripts/discourse/app/lib/sidebar/user/community-section/review-section-link.js b/app/assets/javascripts/discourse/app/lib/sidebar/user/community-section/review-section-link.jsindex 04716cca094..b0e5e83c2a5 100644--- a/app/assets/javascripts/discourse/app/lib/sidebar/user/community-section/review-section-link.js+++ b/app/assets/javascripts/discourse/app/lib/sidebar/user/community-section/review-section-link.js@@ -26,6 +26,7 @@ export default class ReviewSectionLink extends BaseSectionLink {_refreshCanDisplay() {if (!this.currentUser.can_review) {this.canDisplay = false;+ return;}if (this.inMoreDrawer) {diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.jsindex e56736f273d..d48d92e0d13 100644--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-community-section-test.js@@ -711,7 +711,7 @@ acceptance("Sidebar - Logged on user - Community Section", function (needs) {});test("review link is not shown when user cannot review", async function (assert) {- updateCurrentUser({ can_review: false });+ updateCurrentUser({ can_review: false, reviewable_count: 0 });await visit("/");