dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit 77dbc3603cbb9a766b3bcc20f3610c793043fba8
parent 0b413f30e95976ea1a5715dffe1b27a57fd6ff63
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Wed, 24 May 2023 22:51:52 -0700

reorder code

Diffstat:
Mpkg/web/handlers/handlers.go | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/pkg/web/handlers/handlers.go b/pkg/web/handlers/handlers.go @@ -5069,10 +5069,8 @@ Loop: msg := msgTyp.Msg - if msg.User.ID == 0 { - msg.User, _ = db.GetUserByID(msg.UserID) - } if msg.GroupID != nil { + // Verify group authorization userGroupsIDs, _ := db.GetUserRoomGroupsIDs(authUser.ID, msg.RoomID) if !utils.InArr(*msg.GroupID, userGroupsIDs) { continue @@ -5088,10 +5086,13 @@ Loop: msg.ToUser = &toUser } // Skip PMs that are not for the auth user - if msg.User.ID != authUser.ID && msg.ToUser.ID != authUser.ID { + if msg.UserID != authUser.ID && msg.ToUser.ID != authUser.ID { continue } } + if msg.User.ID == 0 { + msg.User, _ = db.GetUserByID(msg.UserID) + } if (pmOnlyQuery == database.PmOnly && msg.ToUser == nil) || (pmOnlyQuery == database.PmNone && msg.ToUser != nil) ||