From 6660b240c8dada67d0967e4811bf29a1161dc1e8 Mon Sep 17 00:00:00 2001 From: Oleksii Kriuchykhin Date: Thu, 28 Jun 2018 15:30:32 +0200 Subject: [PATCH] Fix rendering permissions of inventory annotations [SCI-2534] --- app/services/smart_annotations/tag_to_html.rb | 3 ++- app/services/smart_annotations/tag_to_text.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/services/smart_annotations/tag_to_html.rb b/app/services/smart_annotations/tag_to_html.rb index f782e0022..9d2e1c3c8 100644 --- a/app/services/smart_annotations/tag_to_html.rb +++ b/app/services/smart_annotations/tag_to_html.rb @@ -41,7 +41,8 @@ module SmartAnnotations end def repository_item(name, user, type, object) - if object && SmartAnnotations::PermissionEval.check(user, type, object) + if object + return unless SmartAnnotations::PermissionEval.check(user, type, object) return SmartAnnotations::HtmlPreview.html(nil, type, object) end SmartAnnotations::HtmlPreview.html(name, type, object) diff --git a/app/services/smart_annotations/tag_to_text.rb b/app/services/smart_annotations/tag_to_text.rb index f197338d1..1adc54f2b 100644 --- a/app/services/smart_annotations/tag_to_text.rb +++ b/app/services/smart_annotations/tag_to_text.rb @@ -53,7 +53,8 @@ module SmartAnnotations end def repository_item(name, user, type, object) - if object && SmartAnnotations::PermissionEval.check(user, type, object) + if object + return unless SmartAnnotations::PermissionEval.check(user, type, object) return SmartAnnotations::TextPreview.text(nil, type, object) end SmartAnnotations::TextPreview.text(name, type, object)