Fix issue with invitation to chat from inaccessible operator

This commit is contained in:
Fedor A. Fetisov 2021-04-13 19:11:03 +03:00
parent 74e69aa520
commit 42f5c1a20a
2 changed files with 18 additions and 8 deletions

View File

@ -76,14 +76,22 @@
var visitorId = this.model.id; var visitorId = this.model.id;
var page = Mibew.Objects.Models.page; var page = Mibew.Objects.Models.page;
// Open invite window // Check whether operator could actually chat
Mibew.Popup.open( // (see libs/operator.php, has_online_operators function for details)
page.get('inviteLink') if (page.get('operatorCouldNotInvite')) {
+ '?visitor=' Mibew.Utils.alert(Mibew.Localization.trans('Unable to invite user: groups are enabled, and you don\'t belong to any of them.'));
+ visitorId, }
'ImCenter' + visitorId, else {
Mibew.Utils.buildWindowParams(page.get('inviteWindowParams'))
); // Open invite window
Mibew.Popup.open(
page.get('inviteLink')
+ '?visitor='
+ visitorId,
'ImCenter' + visitorId,
Mibew.Utils.buildWindowParams(page.get('inviteWindowParams'))
);
}
} }
}, },

View File

@ -124,6 +124,8 @@ class UsersController extends AbstractController
'banLink' => $request->getBaseUrl() . '/operator/ban', 'banLink' => $request->getBaseUrl() . '/operator/ban',
'inviteLink' => $request->getBaseUrl() . '/operator/invite', 'inviteLink' => $request->getBaseUrl() . '/operator/invite',
'operatorCouldNotInvite' => (Settings::get('enablegroups') == 1) && !count(get_operator_group_ids($operator['operatorid'])),
'chatWindowParams' => $chat_style_config['chat']['window'], 'chatWindowParams' => $chat_style_config['chat']['window'],
'trackedUserWindowParams' => $page_style_config['tracked']['user_window'], 'trackedUserWindowParams' => $page_style_config['tracked']['user_window'],
'trackedVisitorWindowParams' => $page_style_config['tracked']['visitor_window'], 'trackedVisitorWindowParams' => $page_style_config['tracked']['visitor_window'],