FEATURE: Allow specific groups to view raw email (#26003)

When a post is created by an incoming email, we show
an envelope icon on it which then opens a modal with the
raw email contents. Previously this was staff (admin+mod)
only, but now this commit adds the `view_raw_email_allowed_groups`
site setting, so any group can be added to give users permission
to see this.
This commit is contained in:
Martin Brennan
2024-03-04 13:48:16 +10:00
committed by GitHub
parent fef52c2ab7
commit eca10e56b8
6 changed files with 26 additions and 3 deletions

View File

@@ -130,7 +130,7 @@ export default function transformPost(
postType === postTypes.small_action || post.action_code === "split_topic";
postAtts.canBookmark = !!currentUser;
postAtts.canManage = currentUser && currentUser.get("canManageTopic");
postAtts.canViewRawEmail = currentUser && currentUser.staff;
postAtts.canViewRawEmail = currentUser && currentUser.can_view_raw_email;
postAtts.canArchiveTopic = !!details.can_archive_topic;
postAtts.canCloseTopic = !!details.can_close_topic;
postAtts.canSplitMergeTopic = !!details.can_split_merge_topic;

View File

@@ -75,7 +75,8 @@ class CurrentUserSerializer < BasicUserSerializer
:use_experimental_topic_bulk_actions?,
:use_experimental_topic_bulk_actions?,
:use_admin_sidebar,
:glimmer_header_enabled?
:glimmer_header_enabled?,
:can_view_raw_email
delegate :user_stat, to: :object, private: true
delegate :any_posts, :draft_count, :pending_posts_count, :read_faq?, to: :user_stat
@@ -316,4 +317,8 @@ class CurrentUserSerializer < BasicUserSerializer
def use_experimental_topic_bulk_actions?
scope.user.in_any_groups?(SiteSetting.experimental_topic_bulk_actions_enabled_groups_map)
end
def can_view_raw_email
scope.user.in_any_groups?(SiteSetting.view_raw_email_allowed_groups_map)
end
end