diff --git a/npm/package-lock.json b/npm/package-lock.json index 7aa2bd4..4efcf0b 100644 --- a/npm/package-lock.json +++ b/npm/package-lock.json @@ -1,6 +1,6 @@ { "name": "earthstar-letterbox-layer", - "version": "1.1.0", + "version": "1.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/npm/package.json b/npm/package.json index 99d588a..8a6f040 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "@earthstar-project/rich-threads-layer", - "version": "1.1.0", + "version": "1.2.0", "description": "", "main": "index.cjs", "module": "index.js", diff --git a/src/letterbox_layer.ts b/src/letterbox_layer.ts index 17b1324..304751c 100644 --- a/src/letterbox_layer.ts +++ b/src/letterbox_layer.ts @@ -488,7 +488,7 @@ export default class LetterboxLayer { setThreadRootDraft( content: string, id?: string, - ): ValidationError | WriteResult { + ): ValidationError | string { if (!this._user) { return new ValidationError( "Couldn't clear draft reply without a known user.", @@ -506,11 +506,17 @@ export default class LetterboxLayer { return this.setThreadRootDraft(content, `${parseInt(timestamp) + 1}`); } - return this._storage.set(this._user, { + const res = this._storage.set(this._user, { content, format: "es.4", path: draftPath, }); + + if (isErr(res)) { + return res + } + + return timestamp; } clearThreadRootDraft(id: string) {