From 2b427273b256c0ac7b17a60a368f56ec2a35681e Mon Sep 17 00:00:00 2001 From: Toks Date: Fri, 17 May 2013 13:19:14 -0400 Subject: [PATCH] fixes #1363 --- app/assets/javascripts/common.js | 8 ++++++++ app/views/layouts/default.html.erb | 2 +- app/views/users/_dmail_notice.html.erb | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/common.js b/app/assets/javascripts/common.js index 19de27ca6..f134a93df 100644 --- a/app/assets/javascripts/common.js +++ b/app/assets/javascripts/common.js @@ -16,6 +16,14 @@ $(function() { e.preventDefault(); }); + $("#hide-dmail-notice").click(function(e) { + $dmail_notice = $("#dmail-notice") + $dmail_notice.hide(); + var dmail_id = $dmail_notice.data("id"); + Danbooru.Cookie.put("hide_dmail_notice", dmail_id); + e.preventDefault(); + }); + $("#close-notice-link").click(function(e) { $('#notice').fadeOut("fast"); e.preventDefault(); diff --git a/app/views/layouts/default.html.erb b/app/views/layouts/default.html.erb index 5991d24d7..eda4f4d7a 100644 --- a/app/views/layouts/default.html.erb +++ b/app/views/layouts/default.html.erb @@ -48,7 +48,7 @@ <%= render "users/ban_notice" %> <% end %> - <% if CurrentUser.dmail_count.present? %> + <% if CurrentUser.dmail_count.present? && CurrentUser.dmails.unread.present? && cookies[:hide_dmail_notice].to_i != CurrentUser.dmails.unread.first.id %> <%= render "users/dmail_notice" %> <% end %> diff --git a/app/views/users/_dmail_notice.html.erb b/app/views/users/_dmail_notice.html.erb index 483a4a7e0..3ccdf636d 100644 --- a/app/views/users/_dmail_notice.html.erb +++ b/app/views/users/_dmail_notice.html.erb @@ -1,3 +1,4 @@ -
+

You have <%= link_to "unread mail", dmails_path(:search => {:owner_id => CurrentUser.id, :to_id => CurrentUser.id}, :folder => "received") %>.

+

<%= link_to "Close this", "#", :id => "hide-dmail-notice" %>