From 889773c38d978460297ae84646764e370eeba0c7 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Mon, 6 Nov 2023 00:59:30 +0000 Subject: [PATCH] Re-hook up all the wiki-related modification events. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4614 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- apps/wiki.json | 2 +- apps/wiki/tf-collections-app.js | 61 +++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/apps/wiki.json b/apps/wiki.json index ac880b4d..b0f63af5 100644 --- a/apps/wiki.json +++ b/apps/wiki.json @@ -1,5 +1,5 @@ { "type": "tildefriends-app", "emoji": "📝", - "previous": "&263ro6L8r7tRcrC7LjvY59gC72DlEM/nehd6s7S08sQ=.sha256" + "previous": "&0dFKAKThgExsyMQN99dOX7HP4UBhYYnuhYTILTCO5FI=.sha256" } \ No newline at end of file diff --git a/apps/wiki/tf-collections-app.js b/apps/wiki/tf-collections-app.js index c36e7d0d..04b24f8c 100644 --- a/apps/wiki/tf-collections-app.js +++ b/apps/wiki/tf-collections-app.js @@ -128,6 +128,61 @@ class TfCollectionsAppElement extends LitElement { this.read_wiki_docs(); } + async on_wiki_create(event) { + await tfrpc.rpc.appendMessage(this.whoami, { + type: 'wiki', + name: event.detail.name, + }); + } + + async on_wiki_rename(event) { + await tfrpc.rpc.appendMessage(this.whoami, { + type: 'wiki', + key: event.detail.id, + name: event.detail.name, + }); + } + + async on_wiki_tombstone(event) { + await tfrpc.rpc.appendMessage(this.whoami, { + type: 'wiki', + key: event.detail.id, + tombstone: { + date: new Date().valueOf(), + reason: 'tombstoned by user', + }, + }); + } + + async on_wiki_doc_create(event) { + await tfrpc.rpc.appendMessage(this.whoami, { + type: 'wiki-doc', + parent: this.wiki.id, + name: event.detail.name, + }); + } + + async on_wiki_doc_rename(event) { + await tfrpc.rpc.appendMessage(this.whoami, { + type: 'wiki-doc', + parent: this.wiki.id, + key: event.detail.id, + name: event.detail.name, + }); + } + + async on_wiki_doc_tombstone(event) { + await tfrpc.rpc.appendMessage(this.whoami, { + type: 'wiki-doc', + parent: this.wiki.id, + key: event.detail.id, + tombstone: { + date: new Date().valueOf(), + reason: 'tombstoned by user', + }, + }); + } + async on_wiki_doc_changed(event) { this.wiki_doc = event.detail.value; this.update_hash(); @@ -143,10 +198,16 @@ class TfCollectionsAppElement extends LitElement { ${keyed(this.wiki_doc?.id, html``)} ${this.wiki_doc && this.wiki_doc.parent === this.wiki?.id ? html`