Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhttp://jneen.net/ <jneen@jneen.net>2017-08-01 21:52:43 +0300
committerhttp://jneen.net/ <jneen@jneen.net>2017-08-03 19:07:18 +0300
commit246951bba7965f4257aa50377a981f3c85c67f1e (patch)
tree4625f1f858858d513835393c112ef69a616156cc /app/services/notification_recipient_service.rb
parent934305ffa3eb1662a367761058ae8ded210d3336 (diff)
unmemoize read_ability
since it's only called once now in make_recipient
Diffstat (limited to 'app/services/notification_recipient_service.rb')
-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!