summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2017-08-01 11:52:43 -0700
committerhttp://jneen.net/ <jneen@jneen.net>2017-08-03 09:07:18 -0700
commit246951bba7965f4257aa50377a981f3c85c67f1e (patch)
tree4625f1f858858d513835393c112ef69a616156cc
parent934305ffa3eb1662a367761058ae8ded210d3336 (diff)
downloadgitlab-ce-246951bba7965f4257aa50377a981f3c85c67f1e.tar.gz
unmemoize read_ability
since it's only called once now in make_recipient
-rw-r--r--app/services/notification_recipient_service.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/app/services/notification_recipient_service.rb b/app/services/notification_recipient_service.rb
index b2d805e9f27..97ff1f99f02 100644
--- a/app/services/notification_recipient_service.rb
+++ b/app/services/notification_recipient_service.rb
@@ -87,13 +87,12 @@ module NotificationRecipientService
end
def read_ability
- @read_ability ||=
- case target
- when Issuable
- :"read_#{target.to_ability_name}"
- when Ci::Pipeline
- :read_build # We have build trace in pipeline emails
- end
+ case target
+ when Issuable
+ :"read_#{target.to_ability_name}"
+ when Ci::Pipeline
+ :read_build # We have build trace in pipeline emails
+ end
end
def custom_action
@@ -308,7 +307,9 @@ module NotificationRecipientService
end
def read_ability
- @read_ability ||= :"read_#{target.class.model_name.name.underscore}"
+ return nil if target.nil?
+
+ :"read_#{target.class.model_name.name.underscore}"
end
def build!