[add] handling for "user_renamed" event
Christian Fraß

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"]))
... ...
@@ -7,7 +7,7 @@ dir_build := build
7 7
 ## commands
8 8
 
9 9
 cmd_log := echo "--"
10
-cmd_tsc := tsc --lib es2015,dom
10
+cmd_tsc := tsc --lib es2017,dom
11 11
 cmd_cp := cp
12 12
 cmd_lessc := lessc
13 13
 cmd_mkdir := mkdir -p
14 14