Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fix_msgtype_of_headpat_event.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
sable: patch
---

chang to more standard compliant msgtype `m.emote` for `/headpat` event
10 changes: 10 additions & 0 deletions src/app/components/RenderMessageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,15 @@ function RenderMessageContentInternal({
}

if (msgType === MsgType.Emote) {
if (content['fyi.cisnt.headpat']) {
return (
<MCuteEvent
content={content}
type={CuteEventType.Headpat}
mentionedUserIds={content?.['m.mentions']?.user_ids}
/>
);
}
return (
<MEmote
displayName={displayName}
Expand Down Expand Up @@ -358,6 +367,7 @@ function RenderMessageContentInternal({
mentionedUserIds={content?.['m.mentions']?.user_ids}
/>
);
// as fallback to render older events where msgtype was set instead of m.emote with a custom property
if (msgType === 'fyi.cisnt.headpat')
return (
<MCuteEvent
Expand Down
5 changes: 3 additions & 2 deletions src/app/hooks/useCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1375,11 +1375,12 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
exe: async (payload) => {
const target = payload.trim();
await mx.sendMessage(room.roomId, {
msgtype: 'fyi.cisnt.headpat',
msgtype: 'm.emote',
'm.mentions': {
user_ids: target ? [target] : [],
},
body: `*pat pat*`,
body: `pats ${target || 'you'}`,
'fyi.cisnt.headpat': true,
} as any);
},
},
Expand Down
Loading