mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-15 19:03:09 -06:00
Issue #657 reolved.
This commit is contained in:
parent
3da25ee318
commit
98de4e7c05
|
|
@ -47,7 +47,11 @@ func GetTag(req *http.Request, userId string, roomId string) util.JSONResponse {
|
||||||
req.Context(), localpart, "ROOM_ID", "m.tag",
|
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 {
|
if err != nil {
|
||||||
return httputil.LogThenError(req, err)
|
return httputil.LogThenError(req, err)
|
||||||
|
|
@ -85,13 +89,17 @@ func PutTag(req *http.Request, userId string, roomId string, tag string) util.JS
|
||||||
|
|
||||||
mtag := NewMTag()
|
mtag := NewMTag()
|
||||||
|
|
||||||
|
var properties TagProperties
|
||||||
|
|
||||||
|
if reqErr := httputil.UnmarshalJSONRequest(req, &properties); reqErr != nil {
|
||||||
|
return *reqErr
|
||||||
|
}
|
||||||
|
|
||||||
if len(data) > 0 {
|
if len(data) > 0 {
|
||||||
json.Unmarshal([]byte(data), &mtag)
|
json.Unmarshal([]byte(data), &mtag)
|
||||||
}
|
}
|
||||||
|
|
||||||
mtag.Tags[tag] = TagProperties{
|
mtag.Tags[tag] = properties
|
||||||
Order: 0.5, // Change value based on need
|
|
||||||
}
|
|
||||||
|
|
||||||
newTagData, _ := json.Marshal(mtag)
|
newTagData, _ := json.Marshal(mtag)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue