forked from cory/tildefriends
		
	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
This commit is contained in:
		| @@ -1,5 +1,5 @@ | |||||||
| { | { | ||||||
|   "type": "tildefriends-app", |   "type": "tildefriends-app", | ||||||
|   "emoji": "📝", |   "emoji": "📝", | ||||||
|   "previous": "&263ro6L8r7tRcrC7LjvY59gC72DlEM/nehd6s7S08sQ=.sha256" |   "previous": "&0dFKAKThgExsyMQN99dOX7HP4UBhYYnuhYTILTCO5FI=.sha256" | ||||||
| } | } | ||||||
| @@ -128,6 +128,61 @@ class TfCollectionsAppElement extends LitElement { | |||||||
| 		this.read_wiki_docs(); | 		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) { | 	async on_wiki_doc_changed(event) { | ||||||
| 		this.wiki_doc = event.detail.value; | 		this.wiki_doc = event.detail.value; | ||||||
| 		this.update_hash(); | 		this.update_hash(); | ||||||
| @@ -143,10 +198,16 @@ class TfCollectionsAppElement extends LitElement { | |||||||
| 				<tf-collection | 				<tf-collection | ||||||
| 					.collection=${this.wikis} | 					.collection=${this.wikis} | ||||||
| 					selected_id=${this.wiki?.id} | 					selected_id=${this.wiki?.id} | ||||||
|  | 					@create=${this.on_wiki_create} | ||||||
|  | 					@rename=${this.on_wiki_rename} | ||||||
|  | 					@tombstone=${this.on_wiki_tombstone} | ||||||
| 					@change=${this.on_wiki_changed}></tf-collection> | 					@change=${this.on_wiki_changed}></tf-collection> | ||||||
| 				${keyed(this.wiki_doc?.id, html`<tf-collection | 				${keyed(this.wiki_doc?.id, html`<tf-collection | ||||||
| 					.collection=${this.wiki_docs} | 					.collection=${this.wiki_docs} | ||||||
| 					selected_id=${(this.wiki_doc && this.wiki_doc?.parent == this.wiki?.id) ? this.wiki_doc?.id : ''} | 					selected_id=${(this.wiki_doc && this.wiki_doc?.parent == this.wiki?.id) ? this.wiki_doc?.id : ''} | ||||||
|  | 					@create=${this.on_wiki_doc_create} | ||||||
|  | 					@rename=${this.on_wiki_doc_rename} | ||||||
|  | 					@tombstone=${this.on_wiki_doc_tombstone} | ||||||
| 					@change=${this.on_wiki_doc_changed}></tf-collection>`)} | 					@change=${this.on_wiki_doc_changed}></tf-collection>`)} | ||||||
| 			</div> | 			</div> | ||||||
| 			${this.wiki_doc && this.wiki_doc.parent === this.wiki?.id ? html` | 			${this.wiki_doc && this.wiki_doc.parent === this.wiki?.id ? html` | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user