1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-16 00:14:34 +02:00

Mobile: Resolves #4701: Improve delete dialog message (#5481)

This commit is contained in:
Helmut K. C. Tessarek
2021-10-03 13:41:32 -04:00
committed by GitHub
parent 3bda77d504
commit 5c7dcf0117
3 changed files with 21 additions and 12 deletions

View File

@ -10,7 +10,7 @@ import Tag from './Tag';
const { sprintf } = require('sprintf-js');
import Resource from './Resource';
const { pregQuote } = require('../string-utils.js');
const { pregQuote, substrWithEllipsis } = require('../string-utils.js');
const { _ } = require('../locale');
const ArrayUtils = require('../ArrayUtils.js');
const lodash = require('lodash');
@ -731,6 +731,18 @@ export default class Note extends BaseItem {
}
}
static async deleteMessage(noteIds: string[]): Promise<string|null> {
let msg = '';
if (noteIds.length === 1) {
const note = await Note.load(noteIds[0]);
if (!note) return null;
msg = _('Delete note "%s"?', substrWithEllipsis(note.title, 0, 32));
} else {
msg = _('Delete these %d notes?', noteIds.length);
}
return msg;
}
static dueNotes() {
return this.modelSelectAll('SELECT id, title, body, is_todo, todo_due, todo_completed, is_conflict FROM notes WHERE is_conflict = 0 AND is_todo = 1 AND todo_completed = 0 AND todo_due > ?', [time.unixMs()]);
}