mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
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:
@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user