mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-25 18:06:15 -04:00
Moved path_exists and promises to es6
This commit is contained in:
parent
6ed711a4d8
commit
4ff00e278a
8 changed files with 59 additions and 31 deletions
|
@ -25,7 +25,8 @@ const randomString = require('../utils/randomstring');
|
|||
const hooks = require('../../static/js/pluginfw/hooks');
|
||||
import pad_utils from "../../static/js/pad_utils";
|
||||
import {SmartOpAssembler} from "../../static/js/SmartOpAssembler";
|
||||
const promises = require('../utils/promises');
|
||||
import {} from '../utils/promises';
|
||||
import {timesLimit} from "async";
|
||||
|
||||
/**
|
||||
* Copied from the Etherpad source code. It converts Windows line breaks to Unix
|
||||
|
@ -586,12 +587,14 @@ class Pad {
|
|||
p.push(db.remove(`pad2readonly:${padID}`));
|
||||
|
||||
// delete all chat messages
|
||||
p.push(promises.timesLimit(this.chatHead + 1, 500, async (i: string) => {
|
||||
// @ts-ignore
|
||||
p.push(timesLimit(this.chatHead + 1, 500, async (i: string) => {
|
||||
await this.db.remove(`pad:${this.id}:chat:${i}`, null);
|
||||
}));
|
||||
|
||||
// delete all revisions
|
||||
p.push(promises.timesLimit(this.head + 1, 500, async (i: string) => {
|
||||
// @ts-ignore
|
||||
p.push(timesLimit(this.head + 1, 500, async (i: string) => {
|
||||
await this.db.remove(`pad:${this.id}:revs:${i}`, null);
|
||||
}));
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
*/
|
||||
|
||||
const CustomError = require('../utils/customError');
|
||||
const promises = require('../utils/promises');
|
||||
import {firstSatisfies} from '../utils/promises';
|
||||
const randomString = require('../utils/randomstring');
|
||||
const db = require('./DB');
|
||||
const groupManager = require('./GroupManager');
|
||||
|
@ -79,7 +79,7 @@ exports.findAuthorID = async (groupID:string, sessionCookie: string) => {
|
|||
groupID: string;
|
||||
validUntil: number;
|
||||
}|null) => (si != null && si.groupID === groupID && now < si.validUntil);
|
||||
const sessionInfo = await promises.firstSatisfies(sessionInfoPromises, isMatch);
|
||||
const sessionInfo = await firstSatisfies(sessionInfoPromises, isMatch) as any;
|
||||
if (sessionInfo == null) return undefined;
|
||||
return sessionInfo.authorID;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue