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-helpdesk committed Apr 19, 2024
2 parents 7829e9a + 748c7c5 commit 0ecfa24
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 11 deletions.
11 changes: 7 additions & 4 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
// Keep in mind that this function is also called on clearing cache.
// https://github.com/freescout-helpdesk/freescout/issues/3970
if (!$this->isScheduleRun()) {
return;
}

// Remove failed jobs
$schedule->command('queue:flush')
Expand Down Expand Up @@ -108,7 +111,7 @@ protected function schedule(Schedule $schedule)

// Kill fetch commands running for too long.
// In shedule:run this code is executed every time $schedule->command() in this function is executed.
if ($this->isScheduleRun() && function_exists('shell_exec')) {
if (function_exists('shell_exec')) {
$fetch_command_pids = \Helper::getRunningProcesses($fetch_command_identifier);

// The name of the command here must be exactly the same as below!
Expand Down Expand Up @@ -198,7 +201,7 @@ protected function schedule(Schedule $schedule)
// and the second 'queue:work' command is launched by cron. When `artisan schedule:run` is executed it sees
// that there are two 'queue:work' processes running and kills them.
// After one minute 'queue:work' is executed by cron via `artisan schedule:run` and works in the background.
if ($this->isScheduleRun() && function_exists('shell_exec')) {
if (function_exists('shell_exec')) {
$running_commands = \Helper::getRunningProcesses();

if (count($running_commands) > 1) {
Expand Down Expand Up @@ -253,7 +256,7 @@ protected function schedule(Schedule $schedule)
*/
public function isScheduleRun()
{
if (!\Helper::isConsole()) {
if (\Helper::isConsole()) {
return true;
} else {
return !empty($_SERVER['argv']) && in_array('schedule:run', $_SERVER['argv']);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ConversationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1744,7 +1744,7 @@ public function ajax(Request $request)

if ($conversation->has_attachments) {
foreach ($conversation->threads as $thread) {
if ($thread->has_attachments && !$thread->isDraft()) {
if ($thread->has_attachments && (!$thread->isDraft() || count($conversation->threads) == 1)) {
foreach ($thread->attachments as $attachment) {
if ($request->is_forwarding == 'true') {
$attachment_copy = $attachment->duplicate();
Expand Down
2 changes: 1 addition & 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.135',
'version' => '1.8.136',

/*
|--------------------------------------------------------------------------
Expand Down

0 comments on commit 0ecfa24

Please sign in to comment.