From ac81cefbf175d5ba5b0cf1031cddd2337683e433 Mon Sep 17 00:00:00 2001 From: SUMUKHA-PK Date: Thu, 2 May 2019 09:54:27 +0530 Subject: [PATCH] Fix to the JSONMarshal issue --- .../dendrite/clientapi/routing/room_tagging.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/clientapi/routing/room_tagging.go b/src/github.com/matrix-org/dendrite/clientapi/routing/room_tagging.go index 8d8d557db..f66510e7c 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/routing/room_tagging.go +++ b/src/github.com/matrix-org/dendrite/clientapi/routing/room_tagging.go @@ -163,20 +163,20 @@ func obtainSavedTags( userID string, roomID string, accountDB *accounts.Database, -) (string, gomatrixserverlib.RawJSON, error) { +) (string, []gomatrixserverlib.RawJSON, error) { localpart, _, err := gomatrixserverlib.SplitID('@', userID) if err != nil { - return "",gomatrixserverlib.RawJSON{}, err + return "", []gomatrixserverlib.RawJSON{}, err } data, err := accountDB.GetAccountDataByType( req.Context(), localpart, roomID, "tag", ) 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 @@ -197,3 +197,11 @@ func addDataToDB( 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 +} \ No newline at end of file