mirror of
https://github.com/Mibew/mibew.git
synced 2024-11-15 08:34:11 +03:00
Make possible to disable sending a chat to email
This commit is contained in:
parent
0317979c92
commit
6dae66540d
@ -44,6 +44,17 @@
|
||||
}
|
||||
),
|
||||
|
||||
/**
|
||||
* Override Backbone.Marionette.ItemView.serializeData to pass some
|
||||
* extra fields to template.
|
||||
* @returns {Object} Template data
|
||||
*/
|
||||
serializeData: function() {
|
||||
var data = this.model.toJSON();
|
||||
data.user = Mibew.Objects.Models.user.toJSON();
|
||||
return data;
|
||||
},
|
||||
|
||||
/**
|
||||
* Load and display send mail window
|
||||
*/
|
||||
|
@ -411,6 +411,7 @@ function setup_chatview_for_user(
|
||||
'defaultName' => (bool) (getlocal("Guest") != $thread->userName),
|
||||
'canPost' => true,
|
||||
'isAgent' => false,
|
||||
'canSendEmail' => (bool) (Settings::get('usercansendemail') == "1"),
|
||||
);
|
||||
|
||||
// Set link to send mail page
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
namespace Mibew\Controller\Chat;
|
||||
|
||||
use Mibew\Http\Exception\AccessDeniedException;
|
||||
use Mibew\Http\Exception\NotFoundException;
|
||||
use Mibew\Mail\Template as MailTemplate;
|
||||
use Mibew\Mail\Utils as MailUtils;
|
||||
@ -41,6 +42,12 @@ class MailController extends AbstractController
|
||||
*/
|
||||
public function showFormAction(Request $request)
|
||||
{
|
||||
|
||||
// Check whether this feature is enabled at all
|
||||
if (!Settings::get('usercansendemail')) {
|
||||
throw new AccessDeniedException();
|
||||
}
|
||||
|
||||
$page = array(
|
||||
// Use errors list stored in the request. We need to do so to have
|
||||
// an ability to pass the request from the "submitForm" action.
|
||||
@ -85,6 +92,12 @@ class MailController extends AbstractController
|
||||
*/
|
||||
public function submitFormAction(Request $request)
|
||||
{
|
||||
|
||||
// Check whether this feature is enabled at all
|
||||
if (!Settings::get('usercansendemail')) {
|
||||
throw new AccessDeniedException();
|
||||
}
|
||||
|
||||
$errors = array();
|
||||
|
||||
$thread_id = $request->attributes->get('thread_id');
|
||||
|
@ -116,6 +116,7 @@ class FeaturesController extends AbstractController
|
||||
return array(
|
||||
'enableban',
|
||||
'usercanchangename',
|
||||
'usercansendemail',
|
||||
'enablegroups',
|
||||
'enablegroupsisolation',
|
||||
'enablestatistics',
|
||||
|
@ -86,6 +86,7 @@ class Settings
|
||||
'enablessl' => '0',
|
||||
'forcessl' => '0',
|
||||
'usercanchangename' => '1',
|
||||
'usercansendemail' => '1',
|
||||
'enablegroups' => '0',
|
||||
'enablegroupsisolation' => '0',
|
||||
'enablestatistics' => '1',
|
||||
|
@ -1 +1,3 @@
|
||||
{{#if user.canSendEmail}}
|
||||
<div class="tpl-image" title="{{l10n "Send chat history by e-mail"}}"></div>
|
||||
{{/if}}
|
@ -1 +1,3 @@
|
||||
{{#if user.canSendEmail}}
|
||||
<div class="tpl-image" title="{{l10n "Send chat history by e-mail"}}"></div>
|
||||
{{/if}}
|
@ -42,6 +42,15 @@
|
||||
<br clear="all"/>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="user-can-send-email" class="field-label">{{l10n "Allows users to send chat history by email"}}</label>
|
||||
<div class="field-value">
|
||||
<input id="user-can-send-email" type="checkbox" name="usercansendemail" value="on"{{#if formusercansendemail}} checked="checked"{{/if}}{{#unless canmodify}} disabled="disabled"{{/unless}}/>
|
||||
</div>
|
||||
<label for="user-can-send-email" class="field-description"> — {{l10n "Turn off to disable user's ability to send chat history by email"}}</label>
|
||||
<br clear="all"/>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="enable-ssl" class="field-label">{{l10n "Allow secure connections (SSL)"}}</label>
|
||||
<div class="field-value">
|
||||
|
@ -42,6 +42,15 @@
|
||||
<br clear="all"/>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="user-can-send-email" class="field-label">{{l10n "Allows users to send chat history by email"}}</label>
|
||||
<div class="field-value">
|
||||
<input id="user-can-send-email" type="checkbox" name="usercansendemail" value="on"{{#if formusercansendemail}} checked="checked"{{/if}}{{#unless canmodify}} disabled="disabled"{{/unless}}/>
|
||||
</div>
|
||||
<label for="user-can-send-email" class="field-description"> — {{l10n "Turn off to disable user's ability to send chat history by email"}}</label>
|
||||
<br clear="all"/>
|
||||
</div>
|
||||
|
||||
<div class="field">
|
||||
<label for="enable-ssl" class="field-label">{{l10n "Allow secure connections (SSL)"}}</label>
|
||||
<div class="field-value">
|
||||
|
Loading…
Reference in New Issue
Block a user