mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
event: add helper to append user ID to Mentions
This commit is contained in:
parent
7f18d6b735
commit
32e6f25c34
1 changed files with 7 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ package event
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
|
|
@ -212,6 +213,12 @@ type Mentions struct {
|
|||
Room bool `json:"room,omitempty"`
|
||||
}
|
||||
|
||||
func (m *Mentions) Add(userID id.UserID) {
|
||||
if !slices.Contains(m.UserIDs, userID) {
|
||||
m.UserIDs = append(m.UserIDs, userID)
|
||||
}
|
||||
}
|
||||
|
||||
type EncryptedFileInfo struct {
|
||||
attachment.EncryptedFile
|
||||
URL id.ContentURIString `json:"url"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue