forked from cory/tildefriends
Fix a death spiral.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4612 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -38,27 +38,30 @@ class TfWikiDocElement extends LitElement {
|
||||
this.is_editing = false;
|
||||
}
|
||||
|
||||
async on_save_draft() {
|
||||
async append_message(draft) {
|
||||
let id = await tfrpc.rpc.store_blob(this.blob);
|
||||
this.dispatchEvent(new CustomEvent('publish', {
|
||||
bubbles: true,
|
||||
detail: {
|
||||
id: id,
|
||||
draft: true,
|
||||
},
|
||||
}));
|
||||
let message = {
|
||||
type: 'wiki-doc',
|
||||
key: this.value.id,
|
||||
parent: this.value.parent,
|
||||
blob: id,
|
||||
};
|
||||
if (draft) {
|
||||
message.recps = this.value.editors;
|
||||
print(message);
|
||||
message = await tfrpc.rpc.encrypt(this.whoami, this.value.editors, JSON.stringify(message));
|
||||
}
|
||||
print(message);
|
||||
await tfrpc.rpc.appendMessage(this.whoami, message);
|
||||
this.is_editing = false;
|
||||
}
|
||||
|
||||
async on_save_draft() {
|
||||
return this.append_message(true);
|
||||
}
|
||||
|
||||
async on_publish() {
|
||||
let id = await tfrpc.rpc.store_blob(this.blob);
|
||||
this.dispatchEvent(new CustomEvent('publish', {
|
||||
bubbles: true,
|
||||
detail: {
|
||||
id: id,
|
||||
},
|
||||
}));
|
||||
this.is_editing = false;
|
||||
return this.append_message(false);
|
||||
}
|
||||
|
||||
render() {
|
||||
|
Reference in New Issue
Block a user