1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2024-11-24 03:12:46 +01:00

unfollow followed conversation when re/assigned

If a user is "following" a conversation and the conversation is then assigned to them they no longer need to follow it.
This commit is contained in:
Avenjamin 2023-05-11 09:41:52 +10:00
parent b78838ca23
commit cc7e6aa9ec

View File

@ -645,6 +645,16 @@ class Conversation extends Model
$this->user_id = $user_id; $this->user_id = $user_id;
$this->updateFolder(); $this->updateFolder();
$this->user_updated_at = $now; $this->user_updated_at = $now;
// If user was previously following the conversation then unfollow
if (!is_null($user_id)) {
$follower = Follower::where('conversation_id', $this->id)
->where('user_id', $user_id)
->first();
if ($follower) {
$follower->delete();
}
}
} }
/** /**