forked from cory/tildefriends
		
	Always bugged me that I don't show the total number of child messages, just the direct number.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4141 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		| @@ -186,11 +186,23 @@ class TfMessageElement extends LitElement { | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	total_child_messages(message) { | ||||
| 		if (!message.child_messages) { | ||||
| 			return 0; | ||||
| 		} | ||||
| 		let total = message.child_messages.length; | ||||
| 		for (let m of message.child_messages) | ||||
| 		{ | ||||
| 			total += this.total_child_messages(m); | ||||
| 		} | ||||
| 		return total; | ||||
| 	} | ||||
|  | ||||
| 	render_children() { | ||||
| 		let self = this; | ||||
| 		if (this.message.child_messages?.length) { | ||||
| 			if (this.collapsed) { | ||||
| 				return html`<input type="button" value=${this.message.child_messages?.length + ' More'} @click=${() => self.collapsed = false}></input>`; | ||||
| 				return html`<input type="button" value=${this.total_child_messages(this.message) + ' More'} @click=${() => self.collapsed = false}></input>`; | ||||
| 			} else { | ||||
| 				return html`<input type="button" value="Collapse" @click=${() => self.collapsed = true}></input>${(this.message.child_messages || []).map(x => html`<tf-message .message=${x} whoami=${this.whoami} .users=${this.users} .drafts=${this.drafts}></tf-message>`)}`; | ||||
| 			} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user