fix models that rubocop broke >:(

This commit is contained in:
Devin Howard 2016-09-24 12:59:42 +08:00
parent f8c11f234d
commit 20bd959c69
2 changed files with 2 additions and 14 deletions

View file

@ -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

View file

@ -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 = {})