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

Access user in created_by_user_id in Thread::createExtended()

This commit is contained in:
FreeScout 2021-10-21 05:40:57 -07:00
parent 548517b906
commit 5f9e02012a

View File

@ -903,7 +903,9 @@ class Thread extends Model
$customer = $conversation->customer; $customer = $conversation->customer;
} }
$user_id = $data['user_id'] ?? null; // User which creatd the thread should be passed in created_by_user_id.
// user_id is check for backward compatibility.
$user_id = $data['created_by_user_id'] ?? $data['user_id'] ?? null;
// Check type. // Check type.
if ($data['type'] == Thread::TYPE_CUSTOMER && empty($customer)) { if ($data['type'] == Thread::TYPE_CUSTOMER && empty($customer)) {
@ -954,6 +956,11 @@ class Thread extends Model
$thread->first = true; $thread->first = true;
} }
// Assignee.
if (empty($data['user_id'])) {
$thread->user_id = $conversation->user_id;
}
// Process attachments. // Process attachments.
if (!empty($data['attachments'])) { if (!empty($data['attachments'])) {
$has_attachments = false; $has_attachments = false;