Christian Fraß commited on 2021-11-20 19:12:53
Zeige 2 geänderte Dateien mit 25 Einfügungen und 1 Löschungen.
... | ... |
@@ -101,6 +101,30 @@ namespace ns_model |
101 | 101 |
shall_update_users = true; |
102 | 102 |
break; |
103 | 103 |
} |
104 |
+ case "user_renamed": |
|
105 |
+ { |
|
106 |
+ for (let [channel_name, channel] of Object.entries(model.channels)) |
|
107 |
+ { |
|
108 |
+ for (let user of channel.users) |
|
109 |
+ { |
|
110 |
+ if (user.name === event.data["user_name_old"]) |
|
111 |
+ { |
|
112 |
+ user.name = event.data["user_name_new"]; |
|
113 |
+ channel.entries.push |
|
114 |
+ ({ |
|
115 |
+ "timestamp": event.timestamp, |
|
116 |
+ "kind": enum_entrykind.info, |
|
117 |
+ "sender": null, |
|
118 |
+ "content": `${event.data["user_name_old"]} renamed to ${event.data["user_name_new"]}`, |
|
119 |
+ }); |
|
120 |
+ shall_update_entries = true; |
|
121 |
+ shall_update_users = true; |
|
122 |
+ break; |
|
123 |
+ } |
|
124 |
+ } |
|
125 |
+ } |
|
126 |
+ break; |
|
127 |
+ } |
|
104 | 128 |
case "user_joined": |
105 | 129 |
{ |
106 | 130 |
if (model.channels.hasOwnProperty(event.data["channel"])) |