mirror of
https://github.com/cryptpad/cryptpad.git
synced 2026-09-14 11:05:41 +05:00
refactor(burn after read): remove loop on otherChan
- style: more modern code
This commit is contained in:
parent
ec27fafc31
commit
3af8b46b5a
@ -265,36 +265,28 @@ define([
|
||||
});
|
||||
return teams;
|
||||
};
|
||||
var makeBurnAfterReadingUrl = function (common, href, channel, opts, cb) {
|
||||
var keyPair = Hash.generateSignPair();
|
||||
var parsed = Hash.parsePadUrl(href);
|
||||
var newHref = parsed.getUrl({
|
||||
const makeBurnAfterReadingUrl = (common, href, channel, opts, cb) => {
|
||||
const keyPair = Hash.generateSignPair();
|
||||
const parsed = Hash.parsePadUrl(href);
|
||||
const newHref = parsed.getUrl({
|
||||
ownerKey: keyPair.safeSignKey
|
||||
});
|
||||
var sframeChan = common.getSframeChannel();
|
||||
const sframeChan = common.getSframeChannel();
|
||||
const priv = common.getMetadataMgr().getPrivateData();
|
||||
const { otherChan } = Modal.getOtherChans(priv, opts);
|
||||
nThen(function (waitFor) {
|
||||
nThen((waitFor) => {
|
||||
sframeChan.query('Q_SET_PAD_METADATA', {
|
||||
channel: channel,
|
||||
channels: otherChan,
|
||||
command: 'ADD_OWNERS',
|
||||
value: [keyPair.validateKey]
|
||||
}, waitFor(function (err) {
|
||||
}, waitFor((err) => {
|
||||
if (err) {
|
||||
waitFor.abort();
|
||||
UI.warn(Messages.error);
|
||||
}
|
||||
}));
|
||||
otherChan?.forEach((chan) => {
|
||||
sframeChan.query('Q_SET_PAD_METADATA', {
|
||||
channel: chan,
|
||||
command: 'ADD_OWNERS',
|
||||
value: [keyPair.validateKey]
|
||||
}, waitFor(function (err) {
|
||||
if (err) { console.error(err); }
|
||||
}));
|
||||
});
|
||||
}).nThen(function () {
|
||||
}).nThen(() => {
|
||||
cb(newHref);
|
||||
});
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user