has-friendship/has_friendship

Requester can accept his own friend request

Closed this issue · 3 comments

one.friend_request(other)
one.accept_request(other)

one should not accept the request he created.

Or is this the expected behavior?

I think that right now we are simply not checking since it is not hard to forbid such action in your controller. But probably this action should not be allowed.

It is not an expected behavior. I think this is a sensible suggestion. Please send a PR.

d4mk0 commented

For now i can just use some validation before accept request

if HasFriendship::Friendship.where(status: 'requested', friendable_id: current_user.id, friend_id: requested_user.id).exists?