recent changes now display also newly created notes without any revisions, some extra improvements to the dialog

This commit is contained in:
zadam
2019-09-02 20:26:18 +02:00
parent a981df6282
commit a6f57d7761
4 changed files with 46 additions and 17 deletions

View File

@@ -5,17 +5,38 @@ const protectedSessionService = require('../../services/protected_session');
async function getRecentChanges() {
const recentChanges = await sql.getRows(
`SELECT
notes.isDeleted AS current_isDeleted,
notes.title AS current_title,
notes.isProtected AS current_isProtected,
note_revisions.*
FROM
note_revisions
JOIN notes USING(noteId)
ORDER BY
utcDateModifiedTo DESC
LIMIT 1000`);
`
SELECT * FROM (
SELECT
notes.noteId,
notes.isDeleted AS current_isDeleted,
notes.title AS current_title,
notes.isProtected AS current_isProtected,
note_revisions.title,
note_revisions.utcDateModifiedTo AS date
FROM
note_revisions
JOIN notes USING(noteId)
ORDER BY
utcDateModifiedTo DESC
LIMIT 1000
)
UNION ALL SELECT * FROM (
SELECT
notes.noteId,
notes.isDeleted AS current_isDeleted,
notes.title AS current_title,
notes.isProtected AS current_isProtected,
notes.title,
notes.utcDateCreated AS date
FROM
notes
ORDER BY
utcDateCreated DESC
LIMIT 1000
)
ORDER BY date DESC
LIMIT 200`);
for (const change of recentChanges) {
if (change.current_isProtected) {