diff --git a/app/Console/Commands/FetchEmails.php b/app/Console/Commands/FetchEmails.php index 70e5e6422..2ac4aa6b9 100644 --- a/app/Console/Commands/FetchEmails.php +++ b/app/Console/Commands/FetchEmails.php @@ -167,15 +167,17 @@ public function fetch($mailbox) // Get unseen messages for a period $last_error = ''; + $messages = collect([]); + try { - $messages = $folder->query()->since(now()->subDays($this->option('days')))->leaveUnread(); + $messages_query = $folder->query()->since(now()->subDays($this->option('days')))->leaveUnread(); if ($unseen) { - $messages->unseen(); + $messages_query->unseen(); } if ($no_charset) { - $messages->setCharset(null); + $messages_query->setCharset(null); } - $messages = $messages->get(); + $messages = $messages_query->get(); if (method_exists($client, 'getLastError')) { $last_error = $client->getLastError(); @@ -188,11 +190,11 @@ public function fetch($mailbox) $errors_count = count($client->getErrors()); // Solution for MS mailboxes. // https://github.com/freescout-helpdesk/freescout/issues/176 - $messages = $folder->query()->since(now()->subDays($this->option('days')))->leaveUnread()->setCharset(null); + $messages_query = $folder->query()->since(now()->subDays($this->option('days')))->leaveUnread()->setCharset(null); if ($unseen) { - $messages->unseen(); + $messages_query->unseen(); } - $messages = $messages->get(); + $messages = $messages_query->get(); $no_charset = true; if (count($client->getErrors()) > $errors_count) { @@ -209,7 +211,6 @@ public function fetch($mailbox) } else { $this->error('['.date('Y-m-d H:i:s').'] '.$last_error); $this->logError('Folder: '.$folder->name.'; Error: '.$last_error); - $messages = collect([]); } } diff --git a/app/Customer.php b/app/Customer.php index c6ac1c062..252bbe791 100644 --- a/app/Customer.php +++ b/app/Customer.php @@ -1224,7 +1224,7 @@ public function getPhotoUrl($default_if_empty = true) return ''; } } else { - return asset('/img/default-avatar.png'); + return \Eventy::filter('customer.default_avatar', '/img/default-avatar.png', $this); } } diff --git a/app/Http/Controllers/ModulesController.php b/app/Http/Controllers/ModulesController.php index ae4fd2ce0..1c9408e14 100644 --- a/app/Http/Controllers/ModulesController.php +++ b/app/Http/Controllers/ModulesController.php @@ -54,7 +54,7 @@ public function modules(Request $request) \Module::clearCache(); $modules = \Module::all(); foreach ($modules as $module) { - $installed_modules[] = [ + $module_data = [ 'alias' => $module->getAlias(), 'name' => $module->getName(), 'description' => $module->getDescription(), @@ -74,6 +74,8 @@ public function modules(Request $request) // Determined later 'new_version' => '', ]; + $module_data = \App\Module::formatModuleData($module_data); + $installed_modules[] = $module_data; } // No need, as we update modules list on each page load @@ -85,6 +87,9 @@ public function modules(Request $request) // Prepare directory modules if (is_array($modules_directory)) { foreach ($modules_directory as $i_dir => $dir_module) { + + $modules_directory[$i_dir] = \App\Module::formatModuleData($dir_module); + // Remove modules without aliases if (empty($dir_module['alias'])) { unset($modules_directory[$i_dir]); diff --git a/app/Jobs/SendReplyToCustomer.php b/app/Jobs/SendReplyToCustomer.php index c68eb396a..14d85b1f7 100644 --- a/app/Jobs/SendReplyToCustomer.php +++ b/app/Jobs/SendReplyToCustomer.php @@ -290,8 +290,13 @@ public function handle() $part1['contents.data'] = $reply_mail->render(); try { + // getFolder does not work if sent folder has spaces. $folder = $client->getFolder($imap_sent_folder); - $folder->appendMessage(imap_mail_compose($envelope, [$part1]), '\Seen', now()->format('d-M-Y H:i:s O')); + if ($folder) { + $folder->appendMessage(imap_mail_compose($envelope, [$part1]), '\Seen', now()->format('d-M-Y H:i:s O')); + } else { + \Log::error('Could not save outgoing reply to the IMAP folder (make sure IMAP folder does not have spaces - folders with spaces do not work): '.$imap_sent_folder); + } } catch (\Exception $e) { // Just log error and continue. \Helper::logException($e, 'Could not save outgoing reply to the IMAP folder, IMAP folder not found: '.$imap_sent_folder.' - '); diff --git a/app/Module.php b/app/Module.php index 0b4fdbb2f..80ab8f4d6 100644 --- a/app/Module.php +++ b/app/Module.php @@ -231,6 +231,18 @@ public static function getMissingModules($required_modules, $modules = []) public static function formatName($name) { - return preg_replace("/ Module$/", '', $name); + return preg_replace("/ Module($|.*\[.*\]$)/", '$1', $name); + } + + public static function formatModuleData($module_data) + { + // Add (Third-Party). + if (\App\Module::isOfficial($module_data['authorUrl']) + && $module_data['author'] != 'FreeScout' + && mb_substr(trim($module_data['name']), -1) != ']' + ) { + $module_data['name'] = $module_data['name'].' ['.__('Third-Party').']'; + } + return $module_data; } } diff --git a/config/app.php b/config/app.php index 11b3d7811..02e024820 100644 --- a/config/app.php +++ b/config/app.php @@ -12,7 +12,7 @@ | or any other location as required by the application or its packages. */ - 'version' => '1.8.15', + 'version' => '1.8.16', /* |-------------------------------------------------------------------------- diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index a45b6ee48..6b913fa54 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -86,7 +86,7 @@ diff --git a/resources/views/mailboxes/sidebar_menu.blade.php b/resources/views/mailboxes/sidebar_menu.blade.php index 56524019b..ee8370ff0 100644 --- a/resources/views/mailboxes/sidebar_menu.blade.php +++ b/resources/views/mailboxes/sidebar_menu.blade.php @@ -2,13 +2,14 @@ @php $menu_mailboxes = auth()->user()->mailboxesCanView(); @endphp + @action('mailbox.before_name', $mailbox) @if (count($menu_mailboxes)) @endif @@ -17,4 +18,4 @@ - $mailbox->id]) }}" class="btn btn-bordered btn-sidebar btn-rounded" data-toggle="tooltip" title="{{ __("Open Mailbox") }}"> \ No newline at end of file + $mailbox->id]) }}" class="btn btn-bordered btn-sidebar btn-rounded" data-toggle="tooltip" title="{{ __("Open Mailbox") }}"> diff --git a/resources/views/mailboxes/sidebar_menu_view.blade.php b/resources/views/mailboxes/sidebar_menu_view.blade.php index f2ba2b925..f4c7833a0 100644 --- a/resources/views/mailboxes/sidebar_menu_view.blade.php +++ b/resources/views/mailboxes/sidebar_menu_view.blade.php @@ -1,5 +1,6 @@ @@ -22,4 +23,4 @@ $mailbox->id]) }}" aria-label="{{ __("New Conversation") }}" data-toggle="tooltip" title="{{ __("New Conversation") }}" role="button"> @endif -@action('mailbox.after_sidebar_buttons') \ No newline at end of file +@action('mailbox.after_sidebar_buttons') diff --git a/resources/views/mailboxes/update.blade.php b/resources/views/mailboxes/update.blade.php index 261fec501..0fddedaba 100644 --- a/resources/views/mailboxes/update.blade.php +++ b/resources/views/mailboxes/update.blade.php @@ -19,8 +19,10 @@
-
+ {{ csrf_field() }} + + @action('mailbox.update.before_name', $mailbox)
diff --git a/resources/views/secure/dashboard.blade.php b/resources/views/secure/dashboard.blade.php index a578159a2..1c6c975cc 100644 --- a/resources/views/secure/dashboard.blade.php +++ b/resources/views/secure/dashboard.blade.php @@ -11,6 +11,7 @@ @foreach ($mailboxes as $mailbox)