@everyone is now sent as normal text when a user doesn't have permission

to send it (instead of just disappearing)
This commit is contained in:
2025-02-10 18:04:38 +02:00
parent 5eb32d5556
commit 9da5aa5be4
2 changed files with 7 additions and 4 deletions

View File

@@ -680,9 +680,12 @@ func (m *Model) sendMessage() tea.Cmd {
value := message[len(PingPrefix):index]
switch value {
case "everyone":
pingValue := packet.PingEveryone
ping = &pingValue
message = message[index+1:]
member := state.State.Members[*networkId][*state.UserID]
if member.IsAdmin {
pingValue := packet.PingEveryone
ping = &pingValue
message = message[index+1:]
}
case "admins":
pingValue := packet.PingAdmins
ping = &pingValue

View File

@@ -1,7 +1,7 @@
-- +goose Up
ALTER TABLE messages ADD ping INTEGER DEFAULT NULL;
-- Must be null if freuqencyId is null
-- 0 - @ping:everyone, 1 - @ping:admins, otherwise references userId
-- 0 - @everyone, 1 - @admins, otherwise references userId
-- +goose Down