Module: MuckFriends::Models::MuckUser
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/muck-friends/models/user.rb
Instance Method Summary collapse
-
#become_friends_with(user) ⇒ Object
Assume that ‘user’ is already following the current user.
-
#block_user(user) ⇒ Object
Block a user.
- #blocked?(user) ⇒ Boolean
-
#drop_friend(user) ⇒ Object
Call to remove friend or follower.
-
#feed_to ⇒ Object
Feed to friends and followers.
-
#follow(user) ⇒ Object
Follow the given user.
-
#followed_by?(user) ⇒ Boolean
Indicates whether the given user is following the current user.
-
#following?(user) ⇒ Boolean
Indicates whether the given user is being followed by the current user.
-
#friend_of?(user) ⇒ Boolean
Indicates whether or not the give user is a friend.
- #friendship_with(user) ⇒ Object
-
#has_network? ⇒ Boolean
Indicates whether the user has any followers or friends or if they are following anybody.
-
#stop_following(user) ⇒ Object
Call to stop following another user.
- #unblock_user(user) ⇒ Object
Instance Method Details
#become_friends_with(user) ⇒ Object
Assume that ‘user’ is already following the current user
38 39 40 |
# File 'lib/muck-friends/models/user.rb', line 38 def become_friends_with(user) Friend.make_friends(self, user) end |
#block_user(user) ⇒ Object
Block a user. This prevents them from getting updates.
71 72 73 |
# File 'lib/muck-friends/models/user.rb', line 71 def block_user(user) Friend.block_user(self, user) end |
#blocked?(user) ⇒ Boolean
47 48 49 |
# File 'lib/muck-friends/models/user.rb', line 47 def blocked?(user) Friend.blocked?(self, user) end |
#drop_friend(user) ⇒ Object
Call to remove friend or follower. If following is enabled the user specified by ‘user’ will become a follower of self.
62 63 64 65 66 67 68 |
# File 'lib/muck-friends/models/user.rb', line 62 def drop_friend(user) if MuckFriends.configuration.enable_following Friend.revert_to_follower(self, user) else Friend.stop_being_friends(self, user) end end |
#feed_to ⇒ Object
Feed to friends and followers
28 29 30 |
# File 'lib/muck-friends/models/user.rb', line 28 def feed_to @feed_to_users ||= [self] | self.friends | self.followers # prevent duplicates in the array end |
#follow(user) ⇒ Object
Follow the given user
43 44 45 |
# File 'lib/muck-friends/models/user.rb', line 43 def follow(user) Friend.add_follower(self, user) end |
#followed_by?(user) ⇒ Boolean
Indicates whether the given user is following the current user
80 81 82 |
# File 'lib/muck-friends/models/user.rb', line 80 def followed_by?(user) followers.include?(user) end |
#following?(user) ⇒ Boolean
Indicates whether the given user is being followed by the current user
85 86 87 |
# File 'lib/muck-friends/models/user.rb', line 85 def following?(user) followings.include?(user) end |
#friend_of?(user) ⇒ Boolean
Indicates whether or not the give user is a friend
33 34 35 |
# File 'lib/muck-friends/models/user.rb', line 33 def friend_of?(user) friends.include?(user) end |
#friendship_with(user) ⇒ Object
51 52 53 |
# File 'lib/muck-friends/models/user.rb', line 51 def friendship_with(user) Friend.friendship_with(self, user) end |
#has_network? ⇒ Boolean
Indicates whether the user has any followers or friends or if they are following anybody
90 91 92 |
# File 'lib/muck-friends/models/user.rb', line 90 def has_network? Friend.has_network?(self) end |
#stop_following(user) ⇒ Object
Call to stop following another user
56 57 58 |
# File 'lib/muck-friends/models/user.rb', line 56 def stop_following(user) Friend.stop_following(self, user) end |
#unblock_user(user) ⇒ Object
75 76 77 |
# File 'lib/muck-friends/models/user.rb', line 75 def unblock_user(user) Friend.unblock_user(self, user) end |