Add #can_unsubscribe? to SentNotification

This commit is contained in:
Zeger-Jan van de Weg 2016-01-09 12:47:31 +01:00
parent 58867eff46
commit 36d858bcf9
2 changed files with 5 additions and 1 deletions

View File

@ -62,6 +62,10 @@ class SentNotification < ActiveRecord::Base
end end
end end
def can_unsubscribe?
!for_commit?
end
def for_commit? def for_commit?
noteable_type == "Commit" noteable_type == "Commit"
end end

View File

@ -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. -# 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}. 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 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) = link_to "unsubscribe", unsubscribe_sent_notification_url(@sent_notification)
from this thread or from this thread or
adjust your notification settings. adjust your notification settings.