Skip to content

Commit

Permalink
Merge pull request #4130 from IchHabeHunger54/master
Browse files Browse the repository at this point in the history
Add conversation->changeSubject() and conversation.subject_changed action
  • Loading branch information
freescout-help authored Jul 16, 2024
2 parents 0b7d1dc + 9eb7457 commit b2c7277
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 10 additions & 0 deletions app/Conversation.php
Original file line number Diff line number Diff line change
Expand Up @@ -1767,6 +1767,16 @@ public static function getViewersInfo($conversations, $fields = ['id', 'first_na
return $viewers;
}

public function changeSubject($new_subject, $user = null)
{
$prev_subject = $this->subject;

$this->subject = $new_subject;
$this->save();

\Eventy::action('conversation.subject_changed', $this, $user, $prev_subject);
}

public function changeState($new_state, $user = null)
{
if (!array_key_exists($new_state, self::$states)) {
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/ConversationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2315,8 +2315,7 @@ public function ajax(Request $request)
$subject = trim($subject);

if (!$response['msg'] && $subject) {
$conversation->subject = $subject;
$conversation->save();
$conversation->changeSubject($subject, $user);

$response['status'] = 'success';
}
Expand Down

0 comments on commit b2c7277

Please sign in to comment.