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 Dec 8, 2019
2 parents 5e92827 + 1cd8881 commit b5dd147
Show file tree
Hide file tree
Showing 41 changed files with 1,926 additions and 286 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ FreeScout has been developed from scratch and is not using any copyrighted Help

* No limitations on the number of users, tickets, etc.
* 100% Mobile-friendly.
* Multilingual (English, French, Italian, Portuguese).
* Multilingual (English, French, Italian, Portuguese, Russian, Dutch).
* Seamless email integration.
* Web installer & updater.
* Starred conversations.
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/GenerateVars.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function handle()
{
try {
$params = [
'locales' => config('app.locales'),
'locales' => \Helper::getAllLocales(),
];

//$filesystem = new Filesystem();
Expand Down
13 changes: 9 additions & 4 deletions app/Conversation.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,14 +378,19 @@ public function setPreview($text = '')
public function getDateTitle()
{
if ($this->threads_count == 1) {
$title = __('Created by :person<br/>:date', ['person' => ucfirst(__(
self::$persons[$this->source_via])), 'date' => User::dateFormat($this->created_at, 'M j, Y H:i')]);
$title = __('Created by :person', ['person' => __(ucfirst(self::$persons[$this->source_via]))]);
$title .= '<br/>'.User::dateFormat($this->created_at, 'M j, Y H:i');
} else {
$person = '';
if (!empty(self::$persons[$this->last_reply_from])) {
$person = __(self::$persons[$this->last_reply_from]);
$person = __(ucfirst(self::$persons[$this->last_reply_from]));
}
$title = __('Last reply by :person<br/>:date', ['person' => ucfirst($person), 'date' => User::dateFormat($this->created_at, 'M j, Y H:i')]);
$title = __('Last reply by :person', ['person' => $person]);
$last_reply_at = $this->created_at;
if ($this->last_reply_at) {
$last_reply_at = $this->last_reply_at;
}
$title .= '<br/>'.User::dateFormat($last_reply_at, 'M j, Y H:i');
}

return $title;
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 @@ -1713,7 +1713,7 @@ public function ajax(Request $request)
$conversation->moveToMailbox($mailbox, $user);

$response['status'] = 'success';
\Session::flash('flash_success_floating', __('Conversation Moved'));
\Session::flash('flash_success_floating', __('Conversation moved'));
}

break;
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ModulesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public function ajax(Request $request)
case 'inactive':
$response['msg'] = __('License key has not been activated yet');
case 'site_inactive':
$response['msg'] = __('This app has not been activated yet');
$response['msg'] = __('Your domain is deactivated');
break;
}
}
Expand Down
9 changes: 8 additions & 1 deletion app/Http/Controllers/TranslateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ public function postSend()
$this->manager->exportTranslations('*', false);

// Archive langs folder
$archive_path = \Helper::createZipArchive(base_path().DIRECTORY_SEPARATOR.'resources/lang', 'lang.zip', 'lang');
try {
$archive_path = \Helper::createZipArchive(base_path().DIRECTORY_SEPARATOR.'resources/lang', 'lang.zip', 'lang');
} catch (\Exception $e) {
return [
'status' => 'error',
'error_msg' => $e->getMessage(),
];
}

if ($archive_path) {
$attachments[] = $archive_path;
Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/SendNotificationToUsers.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SendNotificationToUsers implements ShouldQueue
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

// Max retries + 1
public $tries = 6;
public $tries = 168; // One per hour

public $users;

Expand Down
2 changes: 1 addition & 1 deletion app/Jobs/SendReplyToCustomer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SendReplyToCustomer implements ShouldQueue
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

// Number of retries + 1
public $tries = 6;
public $tries = 168; // one per hour

public $conversation;

Expand Down
2 changes: 1 addition & 1 deletion app/Mail/UserInvite.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct($user)
*/
public function build()
{
$message = $this->subject(__('Welcome to :company_name', ['company_name' => Option::get('company_name')]))
$message = $this->subject(__('Welcome to :company_name!', ['company_name' => Option::get('company_name')]))
->view('emails/user/user_invite')
->text('emails/user/user_invite_text');

Expand Down
20 changes: 20 additions & 0 deletions app/Misc/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,26 @@ public static function getCustomLocales()
return \Barryvdh\TranslationManager\Models\Translation::distinct()->pluck('locale')->toArray();
}

/**
* Get built in and custom locales.
*
* @return [type] [description]
*/
public static function getAllLocales()
{
$app_locales = config('app.locales');

// User may add an extra translation to the app on Translate page,
// we should allow user to see his custom translations.
$custom_locales = \Helper::getCustomLocales();

if (count($custom_locales)) {
$app_locales = array_unique(array_merge($app_locales, $custom_locales));
}

return $app_locales;
}

/**
* app()->setLocale() in Localize middleware also changes config('app.locale'),
* so we are keeping real app locale in real_locale parameter.
Expand Down
7 changes: 2 additions & 5 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,8 @@ public function register()
// During module activation in case of any error we have to deactivate module.
\App\Module::deactiveModule($module->getAlias());

// if (\App::runningInConsole()) {
// echo __('The plugin :module_name has been deactivated due to an error: :error_message', ['module_name' => $module->getName(), 'error_message' => $exception->getMessage()]);
// } else {
\Session::flash('flashes_floating', [[
'text' => __('The plugin :module_name has been deactivated due to an error: :error_message', ['module_name' => $module->getName(), 'error_message' => $exception->getMessage()]),
'text' => __('The :module_name module has been deactivated due to an error: :error_message', ['module_name' => $module->getName(), 'error_message' => $exception->getMessage()]),
'type' => 'danger',
'role' => \App\User::ROLE_ADMIN,
]]);
Expand All @@ -76,7 +73,7 @@ public function register()
\App\Module::deactiveModule($module->getAlias());

\Session::flash('flashes_floating', [[
'text' => __('The plugin :module_name has been deactivated due to an error: :error_message', ['module_name' => $module->getName(), 'error_message' => $exception->getMessage()]),
'text' => __('The :module_name module has been deactivated due to an error: :error_message', ['module_name' => $module->getName(), 'error_message' => $exception->getMessage()]),
'type' => 'danger',
'role' => \App\User::ROLE_ADMIN,
]]);
Expand Down
2 changes: 1 addition & 1 deletion app/SendLog.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public function getMailTypeName()
case self::MAIL_TYPE_PASSWORD_CHANGED:
return __('Password changed notification');
case self::MAIL_TYPE_WRONG_USER_EMAIL_MESSAGE:
return __('User using wrong email notification');
return __('User replied from wrong email address');
case self::MAIL_TYPE_TEST:
return __('Test email');
case self::MAIL_TYPE_ALERT:
Expand Down
49 changes: 27 additions & 22 deletions app/Thread.php
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ public function getActionPerson($conversation_number = '')
/**
* Get action text.
*/
public function getActionText($conversation_number = '', $escape = false, $strip_tags = false, $by_user = null)
public function getActionText($conversation_number = '', $escape = false, $strip_tags = false, $by_user = null, $person = '')
{
$did_this = '';

Expand All @@ -560,52 +560,52 @@ public function getActionText($conversation_number = '', $escape = false, $strip

if ($this->action_type == self::ACTION_TYPE_STATUS_CHANGED) {
if ($conversation_number) {
$did_this = __('marked as :status_name conversation #:conversation_number', ['status_name' => $this->getStatusName(), 'conversation_number' => $conversation_number]);
$did_this = __(':person marked as :status_name conversation #:conversation_number', ['status_name' => $this->getStatusName(), 'conversation_number' => $conversation_number]);
} else {
$did_this = __("marked as :status_name", ['status_name' => $this->getStatusName()]);
$did_this = __(":person marked as :status_name", ['status_name' => $this->getStatusName()]);
}
} elseif ($this->action_type == self::ACTION_TYPE_USER_CHANGED) {
$assignee = $this->getAssigneeName(false, $by_user);
if ($escape) {
$assignee = htmlspecialchars($assignee);
}
if ($conversation_number) {
$did_this = __('assigned :assignee convsersation #:conversation_number', ['assignee' => $assignee, 'conversation_number' => $conversation_number]);
$did_this = __(':person assigned :assignee convsersation #:conversation_number', ['assignee' => $assignee, 'conversation_number' => $conversation_number]);
} else {
$did_this = __("assigned to :assignee", ['assignee' => $assignee]);
$did_this = __(":person assigned to :assignee", ['assignee' => $assignee]);
}
} elseif ($this->action_type == self::ACTION_TYPE_CUSTOMER_CHANGED) {
if ($conversation_number) {
$did_this = __('changed the customer to :customer in conversation #:conversation_number', ['customer' => $this->customer->getFullName(true), 'conversation_number' => $conversation_number]);
$did_this = __(':person changed the customer to :customer in conversation #:conversation_number', ['customer' => $this->customer->getFullName(true), 'conversation_number' => $conversation_number]);
} else {
$customer_name = $this->customer_cached->getFullName(true);
if ($escape) {
$customer_name = htmlspecialchars($customer_name);
}
$did_this = __("changed the customer to :customer", ['customer' => '<a href="'.$this->customer_cached->url().'" title="'.$this->action_data.'" class="link-black">'.$customer_name.'</a>']);
$did_this = __(":person changed the customer to :customer", ['customer' => '<a href="'.$this->customer_cached->url().'" title="'.$this->action_data.'" class="link-black">'.$customer_name.'</a>']);
}
} elseif ($this->action_type == self::ACTION_TYPE_DELETED_TICKET) {
$did_this = __("deleted");
$did_this = __(":person deleted");
} elseif ($this->action_type == self::ACTION_TYPE_RESTORE_TICKET) {
$did_this = __("restored");
$did_this = __(":person restored");
} elseif ($this->action_type == self::ACTION_TYPE_MOVED_FROM_MAILBOX) {
$did_this = __("moved conversation from another mailbox");
$did_this = __(":person moved conversation from another mailbox");
}
} elseif ($this->state == self::STATE_DRAFT) {
if (empty($this->edited_by_user_id)) {
$did_this = __('created a draft');
$did_this = __(':person created a draft');
} else {
$did_this = __("edited :creator's draft", ['creator' => $this->created_by_user_cached->getFirstName()]);
$did_this = __(":person edited :creator's draft", ['creator' => $this->created_by_user_cached->getFirstName()]);
}
} else {
if ($this->isForwarded()) {
$did_this = __('forwarded a conversation #:forward_parent_conversation_number', ['forward_parent_conversation_number' => $this->getMeta('forward_parent_conversation_number')]);
$did_this = __(':person forwarded a conversation #:forward_parent_conversation_number', ['forward_parent_conversation_number' => $this->getMeta('forward_parent_conversation_number')]);
} elseif ($this->first) {
$did_this = __('started a new conversation #:conversation_number', ['conversation_number' => $conversation_number]);
$did_this = __(':person started a new conversation #:conversation_number', ['conversation_number' => $conversation_number]);
} elseif ($this->type == self::TYPE_NOTE) {
$did_this = __('added a note to conversation #:conversation_number', ['conversation_number' => $conversation_number]);
$did_this = __(':person added a note to conversation #:conversation_number', ['conversation_number' => $conversation_number]);
} else {
$did_this = __('replied to conversation #:conversation_number', ['conversation_number' => $conversation_number]);
$did_this = __(':person replied to conversation #:conversation_number', ['conversation_number' => $conversation_number]);
}
}

Expand All @@ -615,6 +615,13 @@ public function getActionText($conversation_number = '', $escape = false, $strip
$did_this = strip_tags($did_this);
}

if ($person) {
if ($escape) {
$person = htmlspecialchars($person);
}
$did_this = str_replace(':person', $person, $did_this);
}

return $did_this;
}

Expand All @@ -627,15 +634,13 @@ public function getActionDescription($conversation_number, $escape = true)
$person = $this->getActionPerson($conversation_number);
$did_this = $this->getActionText($conversation_number);

$description = ':person_tag_start:person:person_tag_end :did_this';
if ($escape) {
$description = htmlspecialchars($description);
$person = htmlspecialchars($person);
$did_this = htmlspecialchars($did_this);
}

return __($description, [
'person' => $person,
'person_tag_start' => '<strong>',
'person_tag_end' => '</strong>',
return __($did_this, [
'person' => '<strong>'.$person.'</strong>',
'did_this' => $did_this,
]);
}
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"vendor/nwidart/laravel-modules/src/Json.php",
"vendor/codedge/laravel-selfupdater/src/SourceRepositoryTypes/GithubRepositoryType.php",
"vendor/barryvdh/laravel-translation-manager/src/Manager.php",
"vendor/barryvdh/laravel-translation-manager/src/Controller.php",
"vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php",
"vendor/laravel/framework/src/Illuminate/Routing/UrlGenerator.php",
"vendor/laravel/framework/src/Illuminate/Validation/Concerns/ValidatesAttributes.php",
Expand Down
4 changes: 2 additions & 2 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
| or any other location as required by the application or its packages.
*/

'version' => '1.3.12',
'version' => '1.3.13',

/*
|--------------------------------------------------------------------------
Expand Down Expand Up @@ -92,7 +92,7 @@
*/

'locale' => env('APP_LOCALE', 'en'),
'locales' => ['en', 'fr', 'it', 'pt-PT', 'pt-BR'],
'locales' => ['en', 'fr', 'it', 'pt-PT', 'pt-BR', 'ru', 'nl'],
'default_locale' => 'en',

/*
Expand Down
Loading

0 comments on commit b5dd147

Please sign in to comment.