Class: Post
Instance Method Summary
collapse
Methods included from Utils
#obj_type, #reindex, #sanitize, #sanitize_content, #sanitize_description
#clappers, #claps_count, #followers, #followers_count, #reviews_count, #saves_count
#add_edge, #remove_edge
Instance Method Details
#creator ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'app/models/post.rb', line 34
def creator
{
id: user.id,
first_name: user.first_name,
last_name: user.last_name,
logo_url: user.logo_url_sm
}
end
|
#frontend_link ⇒ Object
53
54
55
|
# File 'app/models/post.rb', line 53
def frontend_link
"/post/#{id}"
end
|
#notif_new_clap(clapper) ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
|
# File 'app/models/post.rb', line 57
def notif_new_clap(clapper)
Notification.create(
target: user,
category: :clap,
type: 'new_clap',
object: self,
metadata: {
clapper: clapper
}
)
end
|
47
48
49
50
51
|
# File 'app/models/post.rb', line 47
def ()
participant_ids = (([user_id] + .pluck(:user_id)).uniq - [.user_id])
User.where(id: participant_ids)
end
|
#users ⇒ Object
43
44
45
|
# File 'app/models/post.rb', line 43
def users
[user, .map(&:user)].flatten.uniq
end
|