MM-21481: Fixed several issues from user marshalling (#13627)
* MM-21481: Fixed several issues from user marshalling - Fixed the root cause for panic by properly converting the map to a User struct. - Added a check for type conversion for extra safety. - Fixed a somewhat unrelated issue of a pointer to pointer reference. * Fix tests
Этот коммит содержится в:
коммит произвёл
Claudio Costa
родитель
87eb7697f9
Коммит
2a28edcd93
@@ -305,7 +305,12 @@ func (wc *WebConn) shouldSendEventToGuest(msg *model.WebSocketEvent) bool {
|
||||
|
||||
switch msg.EventType() {
|
||||
case model.WEBSOCKET_EVENT_USER_UPDATED:
|
||||
userId = msg.GetData()["user"].(*model.User).Id
|
||||
user, ok := msg.GetData()["user"].(*model.User)
|
||||
if !ok {
|
||||
mlog.Error("webhub.shouldSendEvent: user not found in message", mlog.Any("user", msg.GetData()["user"]))
|
||||
return false
|
||||
}
|
||||
userId = user.Id
|
||||
case model.WEBSOCKET_EVENT_NEW_USER:
|
||||
userId = msg.GetData()["user_id"].(string)
|
||||
default:
|
||||
|
||||
Ссылка в новой задаче
Block a user