Skip to content

Commit

Permalink
Merge branch 'master' of github.com:freescout-helpdesk/freescout into…
Browse files Browse the repository at this point in the history
… dist
  • Loading branch information
freescout-help-desk committed Nov 15, 2024
2 parents e2360f2 + 21fe296 commit 009c51e
Show file tree
Hide file tree
Showing 29 changed files with 904 additions and 41 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Mobile apps support the same functionality and modules as the web version of you

## Requirements

FreeScout is a pure PHP/MySQL application, so it can be easily deployed even on a shared hosting.
FreeScout is a pure PHP/MySQL application, so it can be easily deployed even on a [shared hosting](https://2ly.link/20rhd).

* Nginx / Apache / IIS
* PHP 7.1 - 8.x
Expand Down
8 changes: 5 additions & 3 deletions app/Console/Commands/FetchEmails.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ public function fetch($mailbox)
$this->line('['.date('Y-m-d H:i:s').'] Fetching: '.($unseen ? 'UNREAD' : 'ALL'));
}

$page_size = (int)config('app.fetching_bunch_size');
foreach ($folders as $folder) {
$this->line('['.date('Y-m-d H:i:s').'] Folder: '.($folder->full_name ?? $folder->name));

Expand All @@ -279,7 +280,7 @@ public function fetch($mailbox)
if ($no_charset) {
$messages_query->setCharset(null);
}
$messages_query->limit(self::PAGE_SIZE, $page);
$messages_query->limit($page_size, $page);

$messages = $messages_query->get();

Expand Down Expand Up @@ -332,7 +333,7 @@ public function fetch($mailbox)
$this->processMessage($message, $message_id, $dest_mailbox, $this->mailboxes);
}
$page++;
} while (count($messages) == self::PAGE_SIZE);
} while (count($messages) == $page_size);
}

$client->disconnect();
Expand Down Expand Up @@ -729,7 +730,8 @@ public function processMessage($message, $message_id, $mailbox, $mailboxes, $ext
&& !$user_id && !$is_reply && !$prev_thread
// Only if the email has been sent to one mailbox.
&& count($to) == 1 && count($cc) == 0
&& preg_match("/^[\s]*".self::FWD_AS_CUSTOMER_COMMAND."/su", strtolower(trim(strip_tags($body))))
// We need to replace also any potential <style></style> tags.
&& preg_match("/^[\s]*".self::FWD_AS_CUSTOMER_COMMAND."/su", strtolower(trim(\Helper::stripTags($body))))
) {
// Try to get "From:" from body.
$original_sender = $this->getOriginalSenderFromFwd($body);
Expand Down
2 changes: 2 additions & 0 deletions app/Conversation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2221,6 +2221,8 @@ public static function getConvTableSorting($request = null)
'order' => 'desc',
];

$result = \Eventy::filter('conversations.table_sorting', $result);

if (
!empty($request->sorting['sort_by']) && !empty($request->sorting['order']) &&
in_array($request->sorting['sort_by'], ['subject', 'number', 'date']) &&
Expand Down
28 changes: 27 additions & 1 deletion app/Http/Controllers/MailboxesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use App\Conversation;
use App\Folder;
use App\Mailbox;
use App\MailboxUser;
use App\Thread;
use App\User;
use Illuminate\Http\Request;
Expand Down Expand Up @@ -269,8 +270,24 @@ public function permissionsSave($id, Request $request)
$this->authorize('updatePermissions', $mailbox);

$user = auth()->user();
$user_ids = \Eventy::filter('mailbox.permission_users', $request->users ?? [], $id);

// Get pivot data from mailbox_user to pass to sync() not to loose values.
// https://github.com/freescout-help-desk/freescout/issues/4339
$users_with_settings = [];
$mailbox_users = MailboxUser::where('mailbox_id', $id)
//->whereIn('user_id', $user_ids)
->get()
->keyBy('user_id')
->toArray();
foreach ($user_ids as $user_id) {
$users_with_settings[$user_id] = $mailbox_users[$user_id] ?? [];
}

// Settings for admins are being reset here.
// So we restore them below.
$mailbox->users()->sync($users_with_settings);

$mailbox->users()->sync(\Eventy::filter('mailbox.permission_users', $request->users, $id) ?: []);
$mailbox->syncPersonalFolders($request->users);

// Save admins settings.
Expand All @@ -282,6 +299,15 @@ public function permissionsSave($id, Request $request)
$admin->mailboxes()->attach($id);
$mailbox_user = $admin->mailboxesWithSettings()->where('mailbox_id', $id)->first();
}
// Restore settings for admins.
if (!empty($mailbox_users[$admin->id])) {
$admin_settings = $mailbox_users[$admin->id];
foreach (MailboxUser::$pivot_settings as $pivot_parameter) {
if (isset($admin_settings[$pivot_parameter])) {
$mailbox_user->settings->$pivot_parameter = $admin_settings[$pivot_parameter];
}
}
}
$mailbox_user->settings->hide = (isset($request->managers[$admin->id]['hide']) ? (int)$request->managers[$admin->id]['hide'] : false);
$mailbox_user->settings->save();
}
Expand Down
7 changes: 7 additions & 0 deletions app/MailboxUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ class MailboxUser extends Model

public $timestamps = false;

public static $pivot_settings = [
'after_send',
'hide',
'mute',
'access',
];

// Does not work as we receive it via pivot
// protected $casts = [
// 'access' => 'array',
Expand Down
13 changes: 12 additions & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
| or any other location as required by the application or its packages.
*/

'version' => '1.8.156',
'version' => '1.8.157',

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -348,6 +348,17 @@
*/
'since_without_quotes_on_fetching' => env('APP_SINCE_WITHOUT_QUOTES_ON_FETCHING', false),

/*
|--------------------------------------------------------------------------
| Emails are fetched in bunches. The larger the bunch's size the more chances
| to face "Allowed memory size exhausted" error. The smaller its size the more
| connections are made to the mail server and the more time fetching takes.
| https://github.com/freescout-help-desk/freescout/issues/4343
|
|-------------------------------------------------------------------------
*/
'fetching_bunch_size' => env('APP_FETCHING_BUNCH_SIZE', 100),

/*
|--------------------------------------------------------------------------
| Dashboard path.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,27 @@ public function moveMessage(string $folder, $from, $to = null, $uid = IMAP::ST_U
$set = $this->buildSet($from, $to);
$command = $this->buildUIDCommand("MOVE", $uid);

return (bool)$this->requestAndResponse($command, [$set, $this->escapeString($folder)], true);
//return (bool)$this->requestAndResponse($command, [$set, $this->escapeString($folder)], true);
$result = (bool)$this->requestAndResponse($command, [$set, $this->escapeString($folder)], true);

// Fallback to COPY, STORE and EXPUNGE.
// https://github.com/freescout-help-desk/freescout/issues/4313
if (!$result) {
$result = $this->copyMessage($folder, $from, $to);
if (!$result) {
return false;
}
$result = $this->store(['\Deleted'], $from, $to);
if (!$result) {
return false;
}

$this->expunge();

return true;
}

return $result;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions public/js/summernote/summernote.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion resources/lang/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@
"This may take several minutes": "Toto může trvat několik minut",
"This number is not visible to customers. It is only used to track conversations within :app_name": "Toto číslo není pro zákazníky viditelné. Používá se pouze ke sledování konverzací v rámci :app_name",
"This password is incorrect.": "Toto heslo je nesprávné.",
"This reply will go to the customer. :%switch_start%Switch to a note:switch_end if you are replying to :user_name.": "Tato odpověď bude zaslána zákazníkovi. :%switch_start%Přepněte na poznámku:switch_end, pokud odpovídáte na :person_name.",
"This reply will go to the customer. :%switch_start%Switch to a note:%switch_end% if you are replying to :user_name.": "Tato odpověď bude zaslána zákazníkovi. :%switch_start%Přepněte na poznámku:%switch_end%, pokud odpovídáte na :person_name.",
"This setting gives you control over what page loads after you perform an action (send a reply, add a note, change conversation status or assignee).": "Toto nastavení ovlivňuje, jaká stránka se načte po provedení akce (odeslání odpovědi, přidání poznámky, změna stavu konverzace nebo přiřazení).",
"This text will be added to the beginning of each email reply sent to a customer.": "Tento text bude přidán na začátek každé e-mailové odpovědi zaslané zákazníkovi.",
"Thread is not in a draft state": "Vlákno není ve stavu konceptu",
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@
"This may take several minutes": "Dies kann einige Minuten dauern",
"This number is not visible to customers. It is only used to track conversations within :app_name": "Diese Nummer ist nicht sichtbar für Kunden. Sie wird nur benutzt um Gespräche innerhalb :app_name zu nachzuverfolgen.",
"This password is incorrect.": "Das Passwort ist falsch.",
"This reply will go to the customer. :%switch_start%Switch to a note:switch_end if you are replying to :user_name.": "Diese Antwort geht an den Kunden. :%switch_start%Wechsel zu Notizen:switch_end wenn an :user_name geantwortet werden soll.",
"This reply will go to the customer. :%switch_start%Switch to a note:%switch_end% if you are replying to :user_name.": "Diese Antwort geht an den Kunden. :%switch_start%Wechsel zu Notizen:%switch_end% wenn an :user_name geantwortet werden soll.",
"This setting gives you control over what page loads after you perform an action (send a reply, add a note, change conversation status or assignee).": "Diese Einstellung ändert welche Seite geladen wird nachdem eine Aktion ausgeführt wurde (eine Antwort gesendet, eine Notiz hinzugefügt usw.).",
"This text will be added to the beginning of each email reply sent to a customer.": "Dieser Text wird an den Beginn jeder Nachricht die an Kunden gesendet wird gestellt.",
"Thread is not in a draft state": "Unterhaltung ist kein Entwurf",
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@
"This may take several minutes": "Esto puede demorar algunos minutos",
"This number is not visible to customers. It is only used to track conversations within :app_name": "El numero no es visible a los clientes. Sólo es usado para seguir conversaciones con :app_name",
"This password is incorrect.": "La clave es incorrecta.",
"This reply will go to the customer. :%switch_start%Switch to a note:switch_end if you are replying to :user_name.": "Ésta respuesta irá al cliente. :%switch_start%Cambiar a nota:switch_end si estás respondiendo a :user_name.",
"This reply will go to the customer. :%switch_start%Switch to a note:%switch_end% if you are replying to :user_name.": "Ésta respuesta irá al cliente. :%switch_start%Cambiar a nota:%switch_end% si estás respondiendo a :user_name.",
"This setting gives you control over what page loads after you perform an action (send a reply, add a note, change conversation status or assignee).": "Estas configuraciones te dan control sobre que páginas cargar después de realizar alguna acción (enviar una respuesta, agregar una nota, etc).",
"This text will be added to the beginning of each email reply sent to a customer.": "Éste texto será agregado al inicio de cada mensaje de respuesta enviado al cliente.",
"Thread is not in a draft state": "El hilo no es un borrador",
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/fa.json
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@
"This may take several minutes": "این ممکن است چند دقیقه طول بکشد",
"This number is not visible to customers. It is only used to track conversations within :app_name": "این شماره برای مشتریان قابل مشاهده نیست. فقط برای ردیابی مکالمات در :app_name استفاده می شود",
"This password is incorrect.": "این رمز عبور نادرست است.",
"This reply will go to the customer. :%switch_start%Switch to a note:switch_end if you are replying to :user_name.": "این پاسخ به مشتری ارسال می شود. :%switch_start%اگر به :user_name پاسخ می دهید، به note:switch_end بروید.",
"This reply will go to the customer. :%switch_start%Switch to a note:%switch_end% if you are replying to :user_name.": "این پاسخ به مشتری ارسال می شود. :%switch_start%اگر به :user_name پاسخ می دهید، به note:%switch_end% بروید.",
"This setting gives you control over what page loads after you perform an action (send a reply, add a note, change conversation status or assignee).": "این تنظیم به شما امکان می دهد پس از انجام یک عمل (ارسال پاسخ، اضافه کردن یادداشت و غیره) روی صفحه بارگیری کنید.",
"This text will be added to the beginning of each email reply sent to a customer.": "این متن به ابتدای هر پاسخ ایمیل ارسالی به مشتری اضافه می شود.",
"Thread is not in a draft state": "موضوع در حالت پیش نویس نیست",
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@
"This may take several minutes": "Tämä saattaa kestää useita minuutteja",
"This number is not visible to customers. It is only used to track conversations within :app_name": "Tämä numero ei näy asiakkaille. Sitä käytetään vain :app_name :n sisällä käytyjen keskustelujen seurantaan.",
"This password is incorrect.": "Tämä salasana on virheellinen.",
"This reply will go to the customer. :%switch_start%Switch to a note:switch_end if you are replying to :user_name.": "Tämä vastaus menee asiakkaalle. :%switch_start%Vaihda huomautukseen:switch_end jos vastaat :user_name.",
"This reply will go to the customer. :%switch_start%Switch to a note:%switch_end% if you are replying to :user_name.": "Tämä vastaus menee asiakkaalle. :%switch_start%Vaihda huomautukseen:%switch_end% jos vastaat :user_name.",
"This setting gives you control over what page loads after you perform an action (send a reply, add a note, change conversation status or assignee).": "Tämän asetuksen avulla voit hallita sitä, mikä sivu latautuu toiminnon suorittamisen jälkeen (vastauksen lähettäminen, huomautuksen lisääminen, keskustelun tilan tai vastaanottajan muuttaminen).",
"This text will be added to the beginning of each email reply sent to a customer.": "Tämä teksti lisätään jokaisen asiakkaalle lähetettävän sähköpostivastauksen alkuun.",
"Thread is not in a draft state": "Keskustelu ei ole luonnostilassa",
Expand Down
2 changes: 1 addition & 1 deletion resources/lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@
"This may take several minutes": "Cela peut prendre plusieurs minutes",
"This number is not visible to customers. It is only used to track conversations within :app_name": "Ce numéro n'est pas visible pour les clients. Il est uniquement utilisé pour suivre les conversations dans :app_name",
"This password is incorrect.": "Ce mot de passe est incorrect.",
"This reply will go to the customer. :%switch_start%Switch to a note:switch_end if you are replying to :user_name.": "Cette réponse ira au client. :%switch_start%Passez à une note:switch_end si vous répondez à :user_name.",
"This reply will go to the customer. :%switch_start%Switch to a note:%switch_end% if you are replying to :user_name.": "Cette réponse ira au client. :%switch_start%Passez à une note:%switch_end% si vous répondez à :user_name.",
"This setting gives you control over what page loads after you perform an action (send a reply, add a note, change conversation status or assignee).": "Ce paramètre vous permet de contrôler la page qui se charge après avoir effectué une action (envoyer une réponse, ajouter une note, etc.).",
"This text will be added to the beginning of each email reply sent to a customer.": "Ce texte sera ajouté au début de chaque réponse par e-mail envoyée à un client.",
"Thread is not in a draft state": "Le fil n'est pas à l'état de brouillon",
Expand Down
Loading

0 comments on commit 009c51e

Please sign in to comment.