diff options
author | Behouba Manassé <behouba@gmail.com> | 2019-09-30 19:25:04 +0300 |
---|---|---|
committer | Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> | 2019-09-30 17:25:04 +0100 |
commit | 49fd47c86313f036da3a9549e7d14def166f4ea7 (patch) | |
tree | c240e98d90c8e91f3b470ff16e45b43e2d005981 /clientapi/routing | |
parent | 7b454bdd27932d72dbe8edb0b40cb9d6e1cbf954 (diff) |
selectAccountDataByType return ClientEvent pointer instead of slice of ClientEvent (#798)
This pull request is an attempt to fix #773.
Signed-off-by: Kouame Behouba Manassé behouba@gmail.com
Diffstat (limited to 'clientapi/routing')
-rw-r--r-- | clientapi/routing/room_tagging.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clientapi/routing/room_tagging.go b/clientapi/routing/room_tagging.go index 6e7324cd..487081c5 100644 --- a/clientapi/routing/room_tagging.go +++ b/clientapi/routing/room_tagging.go @@ -59,7 +59,7 @@ func GetTags( return httputil.LogThenError(req, err) } - if len(data) == 0 { + if data == nil { return util.JSONResponse{ Code: http.StatusOK, JSON: struct{}{}, @@ -68,7 +68,7 @@ func GetTags( return util.JSONResponse{ Code: http.StatusOK, - JSON: data[0].Content, + JSON: data.Content, } } @@ -103,8 +103,8 @@ func PutTag( } var tagContent gomatrix.TagContent - if len(data) > 0 { - if err = json.Unmarshal(data[0].Content, &tagContent); err != nil { + if data != nil { + if err = json.Unmarshal(data.Content, &tagContent); err != nil { return httputil.LogThenError(req, err) } } else { @@ -155,7 +155,7 @@ func DeleteTag( } // If there are no tags in the database, exit - if len(data) == 0 { + if data == nil { // Spec only defines 200 responses for this endpoint so we don't return anything else. return util.JSONResponse{ Code: http.StatusOK, @@ -164,7 +164,7 @@ func DeleteTag( } var tagContent gomatrix.TagContent - err = json.Unmarshal(data[0].Content, &tagContent) + err = json.Unmarshal(data.Content, &tagContent) if err != nil { return httputil.LogThenError(req, err) } @@ -204,7 +204,7 @@ func obtainSavedTags( userID string, roomID string, accountDB *accounts.Database, -) (string, []gomatrixserverlib.ClientEvent, error) { +) (string, *gomatrixserverlib.ClientEvent, error) { localpart, _, err := gomatrixserverlib.SplitID('@', userID) if err != nil { return "", nil, err |