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:
@@ -1,4 +1,16 @@
|
||||
module UsersHelper
|
||||
def unread_dmail_indicator(user)
|
||||
"(#{user.unread_dmail_count})" if user.unread_dmail_count > 0
|
||||
end
|
||||
|
||||
def has_unread_dmails?(user)
|
||||
user.unread_dmail_count > 0 && (cookies[:hide_dmail_notice].to_i < latest_unread_dmail(user).id)
|
||||
end
|
||||
|
||||
def latest_unread_dmail(user)
|
||||
user.dmails.active.unread.first
|
||||
end
|
||||
|
||||
def email_sig(user)
|
||||
verifier = ActiveSupport::MessageVerifier.new(Danbooru.config.email_key, serializer: JSON, digest: "SHA256")
|
||||
verifier.generate(user.id.to_s)
|
||||
|
||||
Reference in New Issue
Block a user