Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept friend requests only pending #79

Open
fabio0 opened this issue Mar 21, 2017 · 1 comment
Open

Accept friend requests only pending #79

fabio0 opened this issue Mar 21, 2017 · 1 comment

Comments

@fabio0
Copy link

fabio0 commented Mar 21, 2017

Hi, using in some tests I found that if I ask a friend request, then that request is denied, if I ask another request (between same users) when the second one is accepted then all requests from that user are accepted, even if they were denied, so I have 2 friends count but with the same user.

In the trait I think could be changed
/** * @param Model $recipient * * @return bool|int */ public function acceptFriendRequest(Model $recipient) { return $this->findFriendship($recipient)->whereRecipient($this)->update([ 'status' => Status::ACCEPTED, ]); }

with
/** * @param Model $recipient * * @return bool|int */ public function acceptFriendRequest(Model $recipient) { return $this->findFriendship($recipient)->where('status', Status::PENDING)->whereRecipient($this)->update([ 'status' => Status::ACCEPTED, ]); }

on line 86

@hootlex
Copy link
Owner

hootlex commented Mar 21, 2017

Hey, thanks for letting me know.

Can you please submit a pr with the failing test? Feel free to include the fix you mention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants