mirror of
https://github.com/freescout-helpdesk/freescout.git
synced 2024-11-25 03:43:33 +01:00
Fix: Expression of ORDER BY clause is not in SELECT
This commit is contained in:
parent
59aa97c244
commit
e2d01ff10a
@ -76,7 +76,7 @@ class BroadcastNotification extends Notification
|
||||
// Dummy DB notification to pass to the template
|
||||
$db_notification = new \Illuminate\Notifications\DatabaseNotification();
|
||||
|
||||
// HTML for the website notification
|
||||
// HTML for the menu notification (uses same medium as for email)
|
||||
if (in_array(Subscription::MEDIUM_EMAIL, $payload->mediums)) {
|
||||
|
||||
$web_notifications_info = [];
|
||||
@ -84,7 +84,9 @@ class BroadcastNotification extends Notification
|
||||
// Get last reply or note of the conversation to display it's text
|
||||
$last_thread_body = '';
|
||||
$last_thread = Thread::where('conversation_id', $thread->conversation_id)
|
||||
->select(['body'])
|
||||
// Select must contain all fields from orderBy() to avoid:
|
||||
// General error: 3065 Expression #1 of ORDER BY clause is not in SELECT
|
||||
->select(['body', 'created_at'])
|
||||
->whereIn('type', [Thread::TYPE_CUSTOMER, Thread::TYPE_MESSAGE, Thread::TYPE_NOTE])
|
||||
->orderBy('created_at')
|
||||
->first();
|
||||
|
@ -81,7 +81,9 @@ class WebsiteNotification extends Notification
|
||||
// Get last reply or note of the conversation to display it's text
|
||||
if ($threads) {
|
||||
$last_threads = Thread::whereIn('conversation_id', $threads->pluck('conversation_id')->unique()->toArray())
|
||||
->select(['id', 'conversation_id', 'body'])
|
||||
// Select must contain all fields from orderBy() to avoid:
|
||||
// General error: 3065 Expression #1 of ORDER BY clause is not in SELECT
|
||||
->select(['id', 'conversation_id', 'body', 'created_at'])
|
||||
->whereIn('type', [Thread::TYPE_CUSTOMER, Thread::TYPE_MESSAGE, Thread::TYPE_NOTE])
|
||||
->distinct('conversation_id')
|
||||
->orderBy('created_at')
|
||||
|
@ -325,14 +325,14 @@ class Subscription extends Model
|
||||
->delay(now()->addSeconds(Conversation::UNDO_TIMOUT))
|
||||
->onQueue('emails');
|
||||
}
|
||||
// - DB Notification
|
||||
// - Menu notification (uses same medium as for email)
|
||||
foreach ($notify[self::MEDIUM_EMAIL] as $notify_info) {
|
||||
\Notification::send($notify_info['users'], new WebsiteNotification($notify_info['conversation'], $notify_info['threads'][0]));
|
||||
}
|
||||
}
|
||||
|
||||
// Send broadcast notifications:
|
||||
// - Real-time notification in the menu
|
||||
// - Real-time menu notification (uses same medium as for email)
|
||||
// - Browser push notification
|
||||
$broadcasts = [];
|
||||
foreach ([self::MEDIUM_EMAIL, self::MEDIUM_BROWSER] as $medium) {
|
||||
|
Loading…
Reference in New Issue
Block a user