mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-15 19:03:09 -06:00
Fix to the JSONMarshal issue
This commit is contained in:
parent
9a97a68ff3
commit
ac81cefbf1
|
|
@ -163,20 +163,20 @@ func obtainSavedTags(
|
||||||
userID string,
|
userID string,
|
||||||
roomID string,
|
roomID string,
|
||||||
accountDB *accounts.Database,
|
accountDB *accounts.Database,
|
||||||
) (string, gomatrixserverlib.RawJSON, error) {
|
) (string, []gomatrixserverlib.RawJSON, error) {
|
||||||
localpart, _, err := gomatrixserverlib.SplitID('@', userID)
|
localpart, _, err := gomatrixserverlib.SplitID('@', userID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "",gomatrixserverlib.RawJSON{}, err
|
return "", []gomatrixserverlib.RawJSON{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
data, err := accountDB.GetAccountDataByType(
|
data, err := accountDB.GetAccountDataByType(
|
||||||
req.Context(), localpart, roomID, "tag",
|
req.Context(), localpart, roomID, "tag",
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", gomatrixserverlib.RawJSON{}, err
|
return "", []gomatrixserverlib.RawJSON{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return localpart, data.Content, nil
|
return localpart, getContentFromData(data), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// addDataToDB is a utility function to save the tag data into the DB
|
// addDataToDB is a utility function to save the tag data into the DB
|
||||||
|
|
@ -197,3 +197,11 @@ func addDataToDB(
|
||||||
httputil.LogThenError(req, err)
|
httputil.LogThenError(req, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getContentFromData(data []gomatrixserverlib.ClientEvent) []gomatrixserverlib.RawJSON {
|
||||||
|
var contentData []gomatrixserverlib.RawJSON
|
||||||
|
for i:=0 ; i< len(data); i++{
|
||||||
|
contentData = append(contentData,data[i].Content)
|
||||||
|
}
|
||||||
|
return contentData
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue