[fix] info entries
Christian Fraß

Christian Fraß commited on 2021-11-20 16:34:37
Zeige 1 geänderte Dateien mit 24 Einfügungen und 3 Löschungen.

... ...
@@ -102,6 +102,8 @@ namespace ns_model
102 102
 					break;
103 103
 				}
104 104
 				case "user_joined":
105
+				{
106
+					if (model.channels.hasOwnProperty(event.data["channel"]))
105 107
 					{
106 108
 						model.channels[event.data["channel"]].users.push({"name": event.data["user_name"], "role": ""});
107 109
 						model.channels[event.data["channel"]].entries.push
... ...
@@ -113,9 +115,16 @@ namespace ns_model
113 115
 						});
114 116
 						shall_update_users = true;
115 117
 						shall_update_entries = true;
118
+					}
119
+					else
120
+					{
121
+						// do nothing
122
+					}
116 123
 					break;
117 124
 				}
118 125
 				case "user_parted":
126
+				{
127
+					if (model.channels.hasOwnProperty(event.data["channel"]))
119 128
 					{
120 129
 						model.channels[event.data["channel"]].users = model.channels[event.data["channel"]].users.filter
121 130
 						(
... ...
@@ -130,9 +139,16 @@ namespace ns_model
130 139
 						});
131 140
 						shall_update_users = true;
132 141
 						shall_update_entries = true;
142
+					}
143
+					else
144
+					{
145
+						// do nothing
146
+					}
133 147
 					break;
134 148
 				}
135 149
 				case "user_kicked":
150
+				{
151
+					if (model.channels.hasOwnProperty(event.data["channel"]))
136 152
 					{
137 153
 						model.channels[event.data["channel"]].users = model.channels[event.data["channel"]].users.filter
138 154
 						(
... ...
@@ -147,6 +163,11 @@ namespace ns_model
147 163
 						});
148 164
 						shall_update_users = true;
149 165
 						shall_update_entries = true;
166
+					}
167
+					else
168
+					{
169
+						// do nothing
170
+					}
150 171
 					break;
151 172
 				}
152 173
 				case "user_quit":
... ...
@@ -155,11 +176,10 @@ namespace ns_model
155 176
 					{
156 177
 						if (model.channels.hasOwnProperty(channel_name))
157 178
 						{
158
-							model.channels[channel_name].users = model.channels[event.data["channel"]].users.filter
179
+							model.channels[channel_name].users = model.channels[channel_name].users.filter
159 180
 							(
160 181
 								(user) => (user.name != event.data["user_name"])
161 182
 							);
162
-						}
163 183
 							model.channels[channel_name].entries.push
164 184
 							({
165 185
 								"timestamp": event.timestamp,
... ...
@@ -167,9 +187,10 @@ namespace ns_model
167 187
 								"sender": null,
168 188
 								"content": `${event.data["user_name"]} quit`,
169 189
 							});
170
-					}
171 190
 							shall_update_entries = true;
172 191
 							shall_update_users = true;
192
+						}
193
+					}
173 194
 					break;
174 195
 				}
175 196
 				case "message_channel":
176 197