From 49acf514e9cca8ef0629444655f53193d6a6e6db Mon Sep 17 00:00:00 2001 From: Dessalines Date: Tue, 21 Feb 2023 15:53:51 -0500 Subject: [PATCH] Let any mod feature and lock posts. Fixes #875 (#944) * Let any mod feature and lock posts. Fixes #875 * Change to amAdmin --- src/shared/components/post/post-listing.tsx | 57 ++++++++++++--------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/src/shared/components/post/post-listing.tsx b/src/shared/components/post/post-listing.tsx index 7580daf3..d0e72e4d 100644 --- a/src/shared/components/post/post-listing.tsx +++ b/src/shared/components/post/post-listing.tsx @@ -30,6 +30,7 @@ import { UserService, WebSocketService } from "../../services"; import { amAdmin, amCommunityCreator, + amMod, canAdmin, canMod, futureDaysToUnixTime, @@ -614,7 +615,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) || amAdmin()) && ( <> {this.lockButton} {this.featureButton} @@ -848,41 +850,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 && ( + {amAdmin() && (