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:
parent
b78838ca23
commit
cc7e6aa9ec
@ -645,6 +645,16 @@ class Conversation extends Model
|
||||
$this->user_id = $user_id;
|
||||
$this->updateFolder();
|
||||
$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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user