Warn users when the drive is offline

pull/1/head
yflory 5 years ago
parent 77c6269e0c
commit 5c223f1ae1

@ -1000,6 +1000,9 @@ define([
}).nThen(cb);
};
Store.setPadTitle = function (clientId, data, cb) {
if (store.offline) {
return void cb({ error: 'OFFLINE' });
}
var title = data.title;
var href = data.href;
var channel = data.channel;
@ -1811,6 +1814,10 @@ define([
if (!cmdData || !cmdData.cmd) { return; }
//var data = cmdData.data;
var s = getStore(cmdData.teamId);
if (s.offline) {
broadcast([], 'NETWORK_DISCONNECT');
return void cb({ error: 'OFFLINE' });
}
var cb2 = function (data2) {
// Send the CHANGE event to all the stores because the command may have
// affected data from a shared folder used by multiple teams.
@ -2237,9 +2244,11 @@ define([
});
rt.proxy.on('disconnect', function () {
store.offline = true;
broadcast([], 'NETWORK_DISCONNECT');
});
rt.proxy.on('reconnect', function (info) {
store.offline = false;
broadcast([], 'NETWORK_RECONNECT', {myId: info.myId});
});

@ -74,6 +74,12 @@ define([
path: p
});
});
proxy.on('disconnect', function () {
team.offline = true;
});
proxy.on('reconnect', function (info) {
team.offline = false;
});
};
var closeTeam = function (ctx, teamId) {

@ -457,7 +457,7 @@ define([
path: initialPathInDrive // Where to store the pad if we don't have it in our drive
};
Cryptpad.setPadTitle(data, function (err) {
cb(err);
cb({error: err});
});
});
sframeChan.on('EV_SET_TAB_TITLE', function (newTabTitle) {

@ -64,10 +64,13 @@ define([
sframeChan.query('Q_SET_PAD_TITLE_IN_DRIVE', {
title: title,
defaultTitle: defaultTitle
}, function (err) {
}, function (err, obj) {
err = err || (obj && obj.error);
if (err === 'E_OVER_LIMIT') {
return void UI.alert(Messages.pinLimitNotPinned, null, true);
} else if (err) { return; }
} else if (err) {
return UI.alert(Messages.driveOfflineError);
}
evTitleChange.fire(title);
if (titleUpdated) {
titleUpdated(undefined, title);

Loading…
Cancel
Save