Remove chat and userlist when answering a form

pull/1/head
yflory 4 years ago
parent bf8903c517
commit 0dd8c7d255

@ -572,7 +572,9 @@ define([
if (!readOnly) { onLocal(); }
evOnReady.fire(newPad);
common.openPadChat(onLocal);
// In forms, only editors can see the chat
if (!readOnly || type !== 'form') { common.openPadChat(onLocal); }
if (!readOnly && cursorGetter) {
common.openCursorChannel(onLocal);
cursor = common.createCursor(onLocal);

@ -166,6 +166,7 @@ MessengerUI, Messages, Pages) {
var showColors = false;
var updateUserList = function (toolbar, config, forceOffline) {
if (!config.displayed || config.displayed.indexOf('userlist') === -1) { return; }
if (toolbar.isAlone) { return; }
// Make sure the elements are displayed
var $userButtons = toolbar.userlist;
var $userlistContent = toolbar.userlistContent;
@ -1216,6 +1217,7 @@ MessengerUI, Messages, Pages) {
if (!config.metadataMgr) { return; }
var metadataMgr = config.metadataMgr;
var notify = function(type, name, oldname) {
if (toolbar.isAlone) { return; }
// type : 1 (+1 user), 0 (rename existing user), -1 (-1 user)
if (typeof name === "undefined") { return; }
name = name || Messages.anonymous;
@ -1515,6 +1517,15 @@ MessengerUI, Messages, Pages) {
}
};
// disable notification, userlist and chat
toolbar.alone = function () {
toolbar.userlist.hide();
toolbar.chat.hide();
$('.cp-toolbar-userlist-drawer').remove();
$('.cp-toolbar-chat-drawer').remove();
toolbar.isAlone = true;
};
// On log out, remove permanently the realtime elements of the toolbar
Common.onLogout(function () {
failed();

@ -2000,7 +2000,7 @@ define([
];
$invalid.empty().append(content);
});
evOnChange.fire();
evOnChange.fire(true);
}
return h('div.cp-form-send-container', [
@ -2022,7 +2022,8 @@ define([
var _answers = Util.clone(answers || {});
delete _answers._proof;
delete _answers._userdata;
evOnChange.reg(function () {
evOnChange.reg(function (noBeforeUnload) {
if (noBeforeUnload) { return; }
var results = getFormResults();
if (!answers || Sortify(_answers) !== Sortify(results)) {
window.onbeforeunload = function () {
@ -2397,6 +2398,9 @@ define([
var helpMenu = framework._.sfCommon.createHelpMenu(['text', 'pad']);
$toolbarContainer.after(helpMenu.menu);
if (!APP.isEditor) {
framework._.toolbar.alone();
}
var makeFormSettings = function () {
// Private / public status

Loading…
Cancel
Save