From 5f8099033b56243825a4ced3dcebd450114c4ca0 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 21 Feb 2023 11:11:29 -0500 Subject: [PATCH] Let any mod feature and lock posts. Fixes #875 --- src/shared/components/post/post-listing.tsx | 58 ++++++++++++--------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index f8140c3e..78f01d86 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -28,8 +28,8 @@ import { i18n } from "../../i18next"; import { BanType, PurgeType } from "../../interfaces"; import { UserService, WebSocketService } from "../../services"; import { - amAdmin, amCommunityCreator, + amMod, canAdmin, canMod, futureDaysToUnixTime, @@ -608,7 +608,8 @@ export class PostListing extends Component { {this.state.showAdvanced && ( <> {this.showBody && post_view.post.body && this.viewSourceButton} - {this.canModOnSelf_ && ( + {/* Any mod can do these, not limited to hierarchy*/} + {(amMod(this.props.moderators) || this.canAdmin_) && ( <> {this.lockButton} {this.featureButton} @@ -842,41 +843,40 @@ export class PostListing extends Component { } get featureButton() { - const featured_community = this.props.post_view.post.featured_community; - const label_community = featured_community + const featuredCommunity = this.props.post_view.post.featured_community; + const labelCommunity = featuredCommunity ? i18n.t("unfeature_from_community") : i18n.t("feature_in_community"); - const is_admin = amAdmin(); - const featured_local = this.props.post_view.post.featured_local; - const label_local = featured_local + const featuredLocal = this.props.post_view.post.featured_local; + const labelLocal = featuredLocal ? i18n.t("unfeature_from_local") : i18n.t("feature_in_local"); return ( - {is_admin && ( + {this.canAdmin_ && (