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

@ -2701,6 +2701,17 @@ RSpec.describe PostsController do
expect(response.status).to eq(403)
end
it "can view raw email if the user is in the allowed group" do
sign_in(user)
SiteSetting.view_raw_email_allowed_groups = "trust_level_0"
get "/posts/#{post.id}/raw-email.json"
expect(response.status).to eq(200)
json = response.parsed_body
expect(json["raw_email"]).to eq("email_content")
end
it "can view raw email" do
sign_in(moderator)