fix sync / fulltext issue

This commit is contained in:
zadam
2019-04-13 19:34:19 +02:00
parent 7e374e795b
commit 4b934a4a81
2 changed files with 18 additions and 6 deletions

View File

@@ -72,10 +72,19 @@ class Note extends Entity {
*/
/** @returns {Promise<*>} */
async getContent() {
async getContent(silentNotFoundError = false) {
if (this.content === undefined) {
const res = await sql.getRow(`SELECT content, hash FROM note_contents WHERE noteId = ?`, [this.noteId]);
if (!res) {
if (silentNotFoundError) {
return undefined;
}
else {
throw new Error("Cannot find note content for noteId=" + this.noteId);
}
}
this.content = res.content;
this.contentHash = res.contentHash; // used only for note_fulltext consistency check