forked from e621ng/e621ng
[Dmails] Don't mark as read on show for API requests
This commit is contained in:
parent
f477141c63
commit
18f8f99730
@ -27,8 +27,9 @@ class DmailsController < ApplicationController
|
||||
def show
|
||||
@dmail = Dmail.find(params[:id])
|
||||
check_privilege(@dmail)
|
||||
@dmail.mark_as_read! unless Danbooru.config.readonly_mode?
|
||||
respond_with(@dmail)
|
||||
respond_with(@dmail) do |fmt|
|
||||
fmt.html { @dmail.mark_as_read! unless Danbooru.config.readonly_mode? }
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
|
@ -63,6 +63,13 @@ class DmailsControllerTest < ActionDispatch::IntegrationTest
|
||||
should "show dmails owned by the current user" do
|
||||
get_auth dmail_path(@dmail), @dmail.owner
|
||||
assert_response :success
|
||||
assert_predicate @dmail.reload, :is_read?
|
||||
end
|
||||
|
||||
should "not mark the dmail as read for json requests" do
|
||||
get_auth dmail_path(@dmail), @dmail.owner, params: { format: :json }
|
||||
assert_response :success
|
||||
assert_not_predicate @dmail.reload, :is_read?
|
||||
end
|
||||
|
||||
should "not show dmails not owned by the current user" do
|
||||
|
Loading…
Reference in New Issue
Block a user