mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 03:13:11 -06:00
All necessary tests pass
This commit is contained in:
parent
425215ade9
commit
8a46edbddf
|
|
@ -42,6 +42,7 @@ func GetTags(
|
||||||
device *authtypes.Device,
|
device *authtypes.Device,
|
||||||
userID string,
|
userID string,
|
||||||
roomID string,
|
roomID string,
|
||||||
|
syncProducer *producers.SyncAPIProducer,
|
||||||
) util.JSONResponse {
|
) util.JSONResponse {
|
||||||
|
|
||||||
if device.UserID != userID {
|
if device.UserID != userID {
|
||||||
|
|
@ -71,6 +72,11 @@ func GetTags(
|
||||||
return httputil.LogThenError(req, err)
|
return httputil.LogThenError(req, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// send data to syncapi
|
||||||
|
if err := syncProducer.SendData(userID, roomID, "m.tag"); err != nil {
|
||||||
|
return httputil.LogThenError(req, err)
|
||||||
|
}
|
||||||
|
|
||||||
return util.JSONResponse{
|
return util.JSONResponse{
|
||||||
Code: http.StatusOK,
|
Code: http.StatusOK,
|
||||||
JSON: tagContent,
|
JSON: tagContent,
|
||||||
|
|
@ -103,9 +109,9 @@ func PutTag(
|
||||||
|
|
||||||
var properties gomatrix.TagProperties
|
var properties gomatrix.TagProperties
|
||||||
|
|
||||||
// if reqErr := httputil.UnmarshalJSONRequest(req, &properties); reqErr != nil {
|
if reqErr := httputil.UnmarshalJSONRequest(req, &properties); reqErr != nil {
|
||||||
// return *reqErr
|
return *reqErr
|
||||||
// }
|
}
|
||||||
|
|
||||||
tagContent := newTag()
|
tagContent := newTag()
|
||||||
var dataByte []byte
|
var dataByte []byte
|
||||||
|
|
@ -242,12 +248,3 @@ func saveTagData(
|
||||||
|
|
||||||
return accountDB.SaveAccountData(req.Context(), localpart, roomID, "m.tag", string(newTagData))
|
return accountDB.SaveAccountData(req.Context(), localpart, roomID, "m.tag", string(newTagData))
|
||||||
}
|
}
|
||||||
|
|
||||||
// extractEventContents is an utility function to obtain "content" from the ClientEvent
|
|
||||||
func extractEventContents(data []gomatrixserverlib.ClientEvent) []gomatrixserverlib.RawJSON {
|
|
||||||
contentData := make([]gomatrixserverlib.RawJSON, 0, len(data))
|
|
||||||
for i := 0; i < len(data); i++ {
|
|
||||||
contentData = append(contentData, data[i].Content)
|
|
||||||
}
|
|
||||||
return contentData
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -490,7 +490,7 @@ func Setup(
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return util.ErrorResponse(err)
|
return util.ErrorResponse(err)
|
||||||
}
|
}
|
||||||
return GetTags(req, accountDB, device, vars["userId"], vars["roomId"])
|
return GetTags(req, accountDB, device, vars["userId"], vars["roomId"],syncProducer)
|
||||||
}),
|
}),
|
||||||
).Methods(http.MethodGet, http.MethodOptions)
|
).Methods(http.MethodGet, http.MethodOptions)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue