You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To recreate:
Add a friend and then deny that friend request.
Re-add that friend multiple times and you will see multiple entries in the friendship table like this:
Cause:
This is because \Multicaret\Acquaintances\Traits\Friendable::getFriendship() returns the first() match which will always be the entry with status == 'denied' which means \Multicaret\Acquaintances\Traits\Friendable::canBefriend() will always return true
Potential Fix:
In \Multicaret\Acquaintances\Traits\Friendable::getFriendship() add an ->orderBy('created_at' , 'desc') (or updated_at) to get the most recent entry
Or if the intention is to have no duplicate entries in the friendship table then will need to change \Multicaret\Acquaintances\Traits\Friendable::befriend() to an upsert
The text was updated successfully, but these errors were encountered:
To recreate:
Add a friend and then deny that friend request.
Re-add that friend multiple times and you will see multiple entries in the friendship table like this:
Cause:
This is because
\Multicaret\Acquaintances\Traits\Friendable::getFriendship()
returns the first() match which will always be the entry withstatus == 'denied'
which means\Multicaret\Acquaintances\Traits\Friendable::canBefriend()
will always return truePotential Fix:
In
\Multicaret\Acquaintances\Traits\Friendable::getFriendship()
add an->orderBy('created_at' , 'desc')
(or updated_at) to get the most recent entryOr if the intention is to have no duplicate entries in the friendship table then will need to change
\Multicaret\Acquaintances\Traits\Friendable::befriend()
to an upsertThe text was updated successfully, but these errors were encountered: