dmails: allow site owner to read all mails.
Allow site owner to read dmails sent to other users. This is make it easier to investigate spam without having to drop into the dev console.
This commit is contained in:
@@ -16,6 +16,7 @@ class DmailPolicy < ApplicationPolicy
|
||||
end
|
||||
|
||||
def show?
|
||||
return true if user.is_owner?
|
||||
user.is_member? && (record.owner_id == user.id || record.valid_key?(request.params[:key]))
|
||||
end
|
||||
|
||||
|
||||
@@ -99,6 +99,11 @@ class DmailsControllerTest < ActionDispatch::IntegrationTest
|
||||
assert_response 403
|
||||
end
|
||||
|
||||
should "show dmails to the site owner" do
|
||||
get_auth dmail_path(@dmail), create(:owner_user)
|
||||
assert_response :success
|
||||
end
|
||||
|
||||
should "mark dmails as read" do
|
||||
assert_equal(false, @dmail.is_read)
|
||||
get_auth dmail_path(@dmail), @dmail.owner
|
||||
|
||||
Reference in New Issue
Block a user