Merge upstream
This commit is contained in:
commit
2f6f1a7158
47 changed files with 369 additions and 113 deletions
|
@ -62,6 +62,10 @@ export const meta = {
|
|||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
needEnrollmentTutorialToRead: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
closeDuration: {
|
||||
type: 'number',
|
||||
optional: false, nullable: false,
|
||||
|
@ -92,6 +96,7 @@ export const paramDef = {
|
|||
display: { type: 'string', enum: ['normal', 'banner', 'dialog'], default: 'normal' },
|
||||
forExistingUsers: { type: 'boolean', default: false },
|
||||
needConfirmationToRead: { type: 'boolean', default: false },
|
||||
needEnrollmentTutorialToRead: { type: 'boolean', default: false },
|
||||
closeDuration: { type: 'number', default: 0 },
|
||||
displayOrder: { type: 'number', default: 0 },
|
||||
silence: { type: 'boolean', default: false },
|
||||
|
@ -115,6 +120,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
display: ps.display,
|
||||
forExistingUsers: ps.forExistingUsers,
|
||||
needConfirmationToRead: ps.needConfirmationToRead,
|
||||
needEnrollmentTutorialToRead: ps.needEnrollmentTutorialToRead,
|
||||
closeDuration: ps.closeDuration,
|
||||
displayOrder: ps.displayOrder,
|
||||
silence: ps.silence,
|
||||
|
|
|
@ -72,6 +72,10 @@ export const meta = {
|
|||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
needEnrollmentTutorialToRead: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
closeDuration: {
|
||||
type: 'number',
|
||||
optional: false, nullable: false,
|
||||
|
@ -139,6 +143,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
isActive: announcement.isActive,
|
||||
forExistingUsers: announcement.forExistingUsers,
|
||||
needConfirmationToRead: announcement.needConfirmationToRead,
|
||||
needEnrollmentTutorialToRead: announcement.needEnrollmentTutorialToRead,
|
||||
closeDuration: announcement.closeDuration,
|
||||
displayOrder: announcement.displayOrder,
|
||||
silence: announcement.silence,
|
||||
|
|
|
@ -37,6 +37,7 @@ export const paramDef = {
|
|||
display: { type: 'string', enum: ['normal', 'banner', 'dialog'] },
|
||||
forExistingUsers: { type: 'boolean' },
|
||||
needConfirmationToRead: { type: 'boolean' },
|
||||
needEnrollmentTutorialToRead: { type: 'boolean' },
|
||||
closeDuration: { type: 'number', default: 0 },
|
||||
displayOrder: { type: 'number', default: 0 },
|
||||
silence: { type: 'boolean' },
|
||||
|
@ -68,6 +69,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
icon: ps.icon,
|
||||
forExistingUsers: ps.forExistingUsers,
|
||||
needConfirmationToRead: ps.needConfirmationToRead,
|
||||
needEnrollmentTutorialToRead: ps.needEnrollmentTutorialToRead,
|
||||
closeDuration: ps.closeDuration,
|
||||
displayOrder: ps.displayOrder,
|
||||
silence: ps.silence,
|
||||
|
|
|
@ -56,7 +56,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
super(meta, paramDef, async (ps, me) => {
|
||||
const jobs = await this.deliverQueue.getJobs(['delayed']);
|
||||
|
||||
const res = [] as [string, number][];
|
||||
const res = new Map<string, number>();
|
||||
|
||||
for (const job of jobs) {
|
||||
let host: string;
|
||||
|
@ -68,17 +68,15 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
continue;
|
||||
}
|
||||
|
||||
const found = res.find(x => x[0] === host);
|
||||
const found = res.get(host);
|
||||
if (found) {
|
||||
found[1]++;
|
||||
res.set(host, found + 1);
|
||||
} else {
|
||||
res.push([host, 1]);
|
||||
res.set(host, 1);
|
||||
}
|
||||
}
|
||||
|
||||
res.sort((a, b) => b[1] - a[1]);
|
||||
|
||||
return res;
|
||||
return Array.from(res.entries()).sort((a, b) => b[1] - a[1]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
super(meta, paramDef, async (ps, me) => {
|
||||
const jobs = await this.inboxQueue.getJobs(['delayed']);
|
||||
|
||||
const res = [] as [string, number][];
|
||||
const res = new Map<string, number>();
|
||||
|
||||
for (const job of jobs) {
|
||||
let host: string;
|
||||
|
@ -68,17 +68,15 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
|
|||
continue;
|
||||
}
|
||||
|
||||
const found = res.find(x => x[0] === host);
|
||||
const found = res.get(host);
|
||||
if (found) {
|
||||
found[1]++;
|
||||
res.set(host, found + 1);
|
||||
} else {
|
||||
res.push([host, 1]);
|
||||
res.set(host, 1);
|
||||
}
|
||||
}
|
||||
|
||||
res.sort((a, b) => b[1] - a[1]);
|
||||
|
||||
return res;
|
||||
return Array.from(res.entries()).sort((a, b) => b[1] - a[1]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue