From 20bd959c69ac4b4de976887f91534a1ebe6a06b2 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Sat, 24 Sep 2016 12:59:42 +0800 Subject: [PATCH] fix models that rubocop broke >:( --- app/models/synapse.rb | 13 +------------ app/models/topic.rb | 3 +-- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/app/models/synapse.rb b/app/models/synapse.rb index c7161469..798f6a54 100644 --- a/app/models/synapse.rb +++ b/app/models/synapse.rb @@ -22,17 +22,12 @@ class Synapse < ApplicationRecord where('node1_id = ? OR node2_id = ?', topic_id, topic_id) } - # :nocov: delegate :name, to: :user, prefix: true - # :nocov: - # :nocov: def user_image user.image.url end - # :nocov: - # :nocov: def collaborator_ids if defer_to_map defer_to_map.editors.select { |mapper| mapper != user }.map(&:id) @@ -40,18 +35,12 @@ class Synapse < ApplicationRecord [] end end - # :nocov: - # :nocov: def calculated_permission - if defer_to_map - defer_to_map&.permission + defer_to_map&.permission || permission end - # :nocov: - # :nocov: def as_json(_options = {}) super(methods: [:user_name, :user_image, :calculated_permission, :collaborator_ids]) end - # :nocov: end diff --git a/app/models/topic.rb b/app/models/topic.rb index 09d61897..fb635da3 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -74,8 +74,7 @@ class Topic < ApplicationRecord end def calculated_permission - if defer_to_map - defer_to_map&.permission + defer_to_map&.permission || permission end def as_json(_options = {})