Commit 6a3a04f6 authored by evazion's avatar evazion

dmails: fix unread dmail notice when unread_dmail_count is inconsistent.

Fix an exception when the user's unread_dmail_count is nonzero but they
don't have any unread dmails. This normally shouldn't happen unless the
unread_dmail_count is inconsistent.
parent f87ec250
......@@ -4,7 +4,7 @@ module UsersHelper
end
def has_unread_dmails?(user)
user.unread_dmail_count > 0 && (cookies[:hide_dmail_notice].to_i < latest_unread_dmail(user).id)
user.unread_dmail_count > 0 && latest_unread_dmail(user).present? && (cookies[:hide_dmail_notice].to_i < latest_unread_dmail(user).id)
end
def latest_unread_dmail(user)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment