Refactor Reaction model (#11138)
Deleted unused methods that are not found/used across the repository in the Reaction model
This commit is contained in:
parent
540bc1fd84
commit
e0e410e9e2
1 changed files with 1 additions and 43 deletions
|
|
@ -81,11 +81,7 @@ class Reaction < ApplicationRecord
|
|||
end
|
||||
|
||||
def target_user
|
||||
if reactable_type == "User"
|
||||
reactable
|
||||
else
|
||||
reactable.user
|
||||
end
|
||||
reactable_type == "User" ? reactable : reactable.user
|
||||
end
|
||||
|
||||
def negative?
|
||||
|
|
@ -94,10 +90,6 @@ class Reaction < ApplicationRecord
|
|||
|
||||
private
|
||||
|
||||
def indexable?
|
||||
category == "readinglist" && reactable && reactable.published
|
||||
end
|
||||
|
||||
def update_reactable
|
||||
Reactions::UpdateReactableWorker.perform_async(id)
|
||||
end
|
||||
|
|
@ -122,40 +114,6 @@ class Reaction < ApplicationRecord
|
|||
reactable.reading_time if category == "readinglist"
|
||||
end
|
||||
|
||||
def reactable_user
|
||||
return unless category == "readinglist"
|
||||
|
||||
{
|
||||
username: reactable.user_username,
|
||||
name: reactable.user_name,
|
||||
profile_image_90: reactable.user.profile_image_90
|
||||
}
|
||||
end
|
||||
|
||||
def reactable_published_date
|
||||
reactable.readable_publish_date if category == "readinglist"
|
||||
end
|
||||
|
||||
def searchable_reactable_title
|
||||
reactable.title if category == "readinglist"
|
||||
end
|
||||
|
||||
def searchable_reactable_text
|
||||
reactable.body_text[0..350] if category == "readinglist"
|
||||
end
|
||||
|
||||
def searchable_reactable_tags
|
||||
reactable.cached_tag_list if category == "readinglist"
|
||||
end
|
||||
|
||||
def searchable_reactable_path
|
||||
reactable.path if category == "readinglist"
|
||||
end
|
||||
|
||||
def reactable_tags
|
||||
reactable.decorate.cached_tag_list_array if category == "readinglist"
|
||||
end
|
||||
|
||||
def viewable_by
|
||||
user_id
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue