dkforest

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

commit 23154202b00f1ec556b95bf17ce3c78b7ce386af
parent c4c575a0e54442cb58f268fd23f6e83dd245cd2c
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Wed, 19 Feb 2025 14:23:00 -0800

function to send a PM should not accept nil as a valid user to send a PM to

Diffstat:
Mpkg/web/handlers/interceptors/command/command.go | 5+++--
Mpkg/web/handlers/interceptors/slashInterceptor.go | 2+-
2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/pkg/web/handlers/interceptors/command/command.go b/pkg/web/handlers/interceptors/command/command.go @@ -133,8 +133,9 @@ func (c *Command) ZeroMsg(msg string) { c.zeroRawMsg(c.AuthUser, msg, msg) } -func (c *Command) ZeroMsgToUser(toUser *database.User, msg string) { - c.zeroRawMsg(toUser, msg, msg) +// ZeroMsgToUser have the "zero user" send an unprocessed private message to toUser +func (c *Command) ZeroMsgToUser(toUser database.User, msg string) { + c.zeroRawMsg(&toUser, msg, msg) } func (c *Command) ZeroSysMsgTo(user2 *database.User, msg string) { diff --git a/pkg/web/handlers/interceptors/slashInterceptor.go b/pkg/web/handlers/interceptors/slashInterceptor.go @@ -507,7 +507,7 @@ func handleInviteCmd(c *command.Command) (handled bool) { tokensStr := strings.Join(tokens, "<br />") msg := fmt.Sprintf(`invitation tokens from @%s:<br />%s`, c.AuthUser.Username, tokensStr) msg, _ = dutils.ColorifyTaggedUsers(msg, c.DB.GetUsersByUsername) - c.ZeroMsgToUser(&sendToUser, msg) + c.ZeroMsgToUser(sendToUser, msg) }() c.Err = command.NewErrSuccess(fmt.Sprintf("%d tokens sent", len(tokens))) return true