diff --git a/app/models/sent_notification.rb b/app/models/sent_notification.rb index fd12615717b6f06f1b8bfe93c790de8413a34001..03108da17be6194d9a84c348bc9cded6c05fb854 100644 --- a/app/models/sent_notification.rb +++ b/app/models/sent_notification.rb @@ -62,6 +62,10 @@ class SentNotification < ActiveRecord::Base end end + def can_unsubscribe? + !for_commit? + end + def for_commit? noteable_type == "Commit" end diff --git a/app/views/layouts/notify.html.haml b/app/views/layouts/notify.html.haml index da7de41abadadd92d85c0a0759b5ad29cc4c766d..07f9be12f99c2d13998611bda478b74adef13219 100644 --- a/app/views/layouts/notify.html.haml +++ b/app/views/layouts/notify.html.haml @@ -45,7 +45,7 @@ -# Don't link the host is the line below, one link in the email is easier to quickly click than two. You're receiving this email because of your account on #{Gitlab.config.gitlab.host}. If you'd like to receive fewer emails, you can - - if @sent_notification && !@sent_notification.for_commit? + - if @sent_notification && @sent_notification.can_unsubscribe? = link_to "unsubscribe", unsubscribe_sent_notification_url(@sent_notification) from this thread or adjust your notification settings.