Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging

This commit is contained in:
yflory
2017-11-21 17:37:53 +01:00
10 changed files with 31 additions and 55 deletions

View File

@@ -633,6 +633,13 @@ define([
});
};
messenger.clearOwnedChannel = function (channel, cb) {
common.clearOwnedChannel(channel, function (e) {
if (e) { return void cb(e); }
cb();
});
};
// TODO listen for changes to your friend list
// emit 'update' events for clients

View File

@@ -559,6 +559,13 @@ define([
});
});
});
sframeChan.on('Q_CONTACTS_CLEAR_OWNED_CHANNEL', function (channel, cb) {
messenger.clearOwnedChannel(channel, function (e) {
cb({
error: e,
});
});
});
messenger.on('message', function (message) {
sframeChan.event('EV_CONTACTS_MESSAGE', message);

View File

@@ -108,6 +108,12 @@ define([], function () {
});
};
messenger.clearOwnedChannel = function (channel, cb) {
sFrameChan.query('Q_CONTACTS_CLEAR_OWNED_CHANNEL', channel, function (e) {
cb(e);
});
};
return messenger;
};

View File

@@ -156,6 +156,7 @@ define({
'Q_CONTACTS_GET_MORE_HISTORY': true,
'Q_CONTACTS_SEND_MESSAGE': true,
'Q_CONTACTS_SET_CHANNEL_HEAD': true,
'Q_CONTACTS_CLEAR_OWNED_CHANNEL': true,
// Put one or more entries to the localStore which will go in localStorage.
'EV_LOCALSTORE_PUT': true,

View File

@@ -9,6 +9,7 @@ define([
'/contacts/messenger-ui.js',
'/common/sframe-messenger-inner.js',
'/customize/messages.js',
'/common/common-interface.js',
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
@@ -21,9 +22,10 @@ define([
nThen,
SFCommon,
h,
UI,
MessengerUI,
Messenger,
Messages
Messages,
UI
)
{
var APP = {};
@@ -73,7 +75,7 @@ define([
var messenger = Messenger.create(sFrameChan);
UI.create(messenger, $(friendList), $(messaging), common);
MessengerUI.create(messenger, $(friendList), $(messaging), common);
UI.removeLoadingScreen();

View File

@@ -176,7 +176,8 @@ define([
$(removeHistory).click(function () {
UI.confirm(Messages.contacts_confirmRemoveHistory, function (yes) {
if (!yes) { return; }
Cryptpad.clearOwnedChannel(data.channel, function (e) {
messenger.clearOwnedChannel(data.channel, function (e) {
if (e) {
console.error(e);
UI.alert(Messages.contacts_removeHistoryServerError);

View File

@@ -186,8 +186,6 @@ define([
};
var onInit = function () {
UI.addLoadingScreen();
$body.on('dragover', function (e) { e.preventDefault(); });
$body.on('drop', function (e) { e.preventDefault(); });