mirror of
https://mau.dev/mautrix/go.git
synced 2026-03-14 14:25:53 +01:00
Add simpler method for adding extra profile field
This commit is contained in:
parent
38f589d24b
commit
da21d03166
1 changed files with 6 additions and 0 deletions
|
|
@ -14,6 +14,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"go.mau.fi/util/dbutil"
|
||||
"go.mau.fi/util/exerrors"
|
||||
|
||||
"maunium.net/go/mautrix/bridgev2/networkid"
|
||||
"maunium.net/go/mautrix/crypto/canonicaljson"
|
||||
|
|
@ -43,6 +44,11 @@ func (ep *ExtraProfile) Set(key string, value any) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (ep *ExtraProfile) With(key string, value any) *ExtraProfile {
|
||||
exerrors.PanicIfNotNil(ep.Set(key, value))
|
||||
return ep
|
||||
}
|
||||
|
||||
func canonicalizeIfObject(data json.RawMessage) json.RawMessage {
|
||||
if len(data) > 0 && (data[0] == '{' || data[0] == '[') {
|
||||
return canonicaljson.CanonicalJSONAssumeValid(data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue