dmails: allow marking dmails as unread.
* Add ability to mark dmails as unread. * Fix users.unread_dmail_count to not count deleted dmails. * Fix show action so that API calls don't mark dmails as read. * Don't show the unread dmail notice on the /dmails page itself. * Stop using users.has_mail flag.
This commit is contained in:
@@ -22,7 +22,7 @@ class DmailsController < ApplicationController
|
||||
def show
|
||||
@dmail = Dmail.find(params[:id])
|
||||
check_privilege(@dmail)
|
||||
@dmail.mark_as_read!
|
||||
@dmail.update!(is_read: true) if request.format.html?
|
||||
respond_with(@dmail)
|
||||
end
|
||||
|
||||
@@ -41,10 +41,8 @@ class DmailsController < ApplicationController
|
||||
end
|
||||
|
||||
def mark_all_as_read
|
||||
Dmail.visible.unread.each do |x|
|
||||
x.update_column(:is_read, true)
|
||||
end
|
||||
CurrentUser.user.update(has_mail: false, unread_dmail_count: 0)
|
||||
@dmails = CurrentUser.user.dmails.mark_all_as_read
|
||||
respond_with(@dmails)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
Reference in New Issue
Block a user