~abyxcos/hummingbird

8bc5b6118038705f125fd1463f18e731a5934d29 — abyxcos 11 months ago 0734b67
Fix our replies being flagged as replies. We would get undefined back if both no relation existed and there was no rel_type field.
1 files changed, 14 insertions(+), 15 deletions(-)

M hummingbird_ajax.js
M hummingbird_ajax.js => hummingbird_ajax.js +14 -15
@@ 239,21 239,20 @@ function parseMessageEvents(events, room) {
			// format: "org.matrix.custom.html"

			// Check if we have any edits or replies.
			switch (e.content['m.relates_to']?.rel_type) {
			case undefined:
				// No relation exists.
				break
			case 'm.replace':
				m.edit = e.content['m.relates_to'].event_id
				// Manually merge the new message as someone may have changed the type.
				m.type = e.content['m.new_content'].msgtype
				m.body = e.content['m.new_content'].formatted_body ||
					e.content['m.new_content'].formatted_body
				break
			case 'net.maunium.reply':
			default:
				m.reply = e.content['m.relates_to']['m.in_reply_to'].event_id
				break
			if (e.content['m.relates_to']) {
				switch (e.content['m.relates_to'].rel_type) {
				case 'm.replace':
					m.edit = e.content['m.relates_to'].event_id
					// Manually merge the new message as someone may have changed the type.
					m.type = e.content['m.new_content'].msgtype
					m.body = e.content['m.new_content'].formatted_body ||
						e.content['m.new_content'].formatted_body
					break
				case 'net.maunium.reply':
				default:
					m.reply = e.content['m.relates_to']['m.in_reply_to'].event_id
					break
				}
			}

			break