Issue #657 reolved.

This commit is contained in:
SUMUKHA-PK 2019-03-13 14:59:38 +05:30
parent 3da25ee318
commit 98de4e7c05

View file

@ -47,7 +47,11 @@ func GetTag(req *http.Request, userId string, roomId string) util.JSONResponse {
req.Context(), localpart, "ROOM_ID", "m.tag",
)
json.Unmarshal([]byte(data), &mtag)
if err != nil {
return httputil.LogThenError(req, err)
}
err = json.Unmarshal([]byte(data), &mtag)
if err != nil {
return httputil.LogThenError(req, err)
@ -85,13 +89,17 @@ func PutTag(req *http.Request, userId string, roomId string, tag string) util.JS
mtag := NewMTag()
var properties TagProperties
if reqErr := httputil.UnmarshalJSONRequest(req, &properties); reqErr != nil {
return *reqErr
}
if len(data) > 0 {
json.Unmarshal([]byte(data), &mtag)
}
mtag.Tags[tag] = TagProperties{
Order: 0.5, // Change value based on need
}
mtag.Tags[tag] = properties
newTagData, _ := json.Marshal(mtag)