Fix channel renaming M->I

This commit is contained in:
emerson 2022-02-02 12:51:34 -05:00
parent 8c48d095e5
commit fbc933ac47
2 changed files with 6 additions and 4 deletions

View file

@ -54,7 +54,7 @@ Note that there are no PMs, because Matrix doesn't differentiate between DMs and
| Encrypted rooms | ❌ | ❌ | [#20](https://todo.sr.ht/~emerson/reflectionircd/20) | | Encrypted rooms | ❌ | ❌ | [#20](https://todo.sr.ht/~emerson/reflectionircd/20) |
| Rich text | ❌ | ❌ | [#31](https://todo.sr.ht/~emerson/reflectionircd/31) | | Rich text | ❌ | ❌ | [#31](https://todo.sr.ht/~emerson/reflectionircd/31) |
| Presence | ❌ | ❌ | [#25](https://todo.sr.ht/~emerson/reflectionircd/25) Note that not all homeservers have presence enabled | | Presence | ❌ | ❌ | [#25](https://todo.sr.ht/~emerson/reflectionircd/25) Note that not all homeservers have presence enabled |
| Channel renaming <small>(IRCv3)</small> | 🟨 | ❌ | [#29](https://todo.sr.ht/~emerson/reflectionircd/29) [#16](https://todo.sr.ht/~emerson/reflectionircd/16) Only when the canonical alias changes | | Channel renaming <small>(IRCv3)</small> | ✅ | ❌ | [#16](https://todo.sr.ht/~emerson/reflectionircd/16) |
| Message replies <small>(IRCv3)</small> | ✅ | ✅ | Clients without support will still receive the reply message, but it won't be marked as a reply | | Message replies <small>(IRCv3)</small> | ✅ | ✅ | Clients without support will still receive the reply message, but it won't be marked as a reply |
| Message reactions <small>(IRCv3)</small> | ✅ | ✅ | Can't undo reactions yet | | Message reactions <small>(IRCv3)</small> | ✅ | ✅ | Can't undo reactions yet |
| Extended invites <small>(IRCv3)</small> | ✅ | ✅ || | Extended invites <small>(IRCv3)</small> | ✅ | ✅ ||

View file

@ -260,9 +260,11 @@ export class IRCUser {
} }
updateRoomName(newNameEvent: any, targetChannel: Channel) { updateRoomName(newNameEvent: any, targetChannel: Channel) {
const newName: string = newNameEvent["content"]["alias"]; let newName: string = newNameEvent["content"]["alias"];
if (!newName || newName === targetChannel.name) if (newName === targetChannel.name)
return; return;
if (!newName || newName === "")
newName = targetChannel.roomId;
const oldName = targetChannel.name; const oldName = targetChannel.name;
this.channels.delete(oldName); this.channels.delete(oldName);
targetChannel.name = newName; targetChannel.name = newName;
@ -272,7 +274,7 @@ export class IRCUser {
client.sendMessage(this.server.name, "RENAME", [oldName, targetChannel.name, "New channel name set"], new Map()); client.sendMessage(this.server.name, "RENAME", [oldName, targetChannel.name, "New channel name set"], new Map());
} }
else { else {
client.sendMessage(this.server.name, "PART", [oldName, "Renaming channel"], new Map()); client.sendMessage(this.getMask(), "PART", [oldName, `Renaming channel to ${newName}`], new Map());
this.joinNewIRCClient(client, targetChannel); this.joinNewIRCClient(client, targetChannel);
} }
}) })