Skip to content

Commit

Permalink
Return draft ids
Browse files Browse the repository at this point in the history
  • Loading branch information
sgwilym committed Aug 12, 2021
1 parent 7c39301 commit 697291a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
10 changes: 8 additions & 2 deletions src/letterbox_layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand All @@ -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) {
Expand Down

0 comments on commit 697291a

Please sign in to comment.