mirror of
https://github.com/indentlabs/notebook.git
synced 2025-10-26 11:19:22 +00:00
11 lines
422 B
Ruby
11 lines
422 B
Ruby
class UserBlocking < ApplicationRecord
|
|
belongs_to :user
|
|
belongs_to :blocked_user, class_name: User.name
|
|
|
|
after_create do
|
|
# If a user blocks someone, we should automatically unfollow both pairings
|
|
UserFollowing.find_by(user_id: self.user_id, followed_user_id: self.blocked_user_id).try(:destroy)
|
|
UserFollowing.find_by(user_id: self.blocked_user_id, followed_user_id: self.user_id).try(:destroy)
|
|
end
|
|
end
|