mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-15 10:53:09 -06:00
All necessary tests pass
This commit is contained in:
parent
425215ade9
commit
8a46edbddf
|
|
@ -42,6 +42,7 @@ func GetTags(
|
|||
device *authtypes.Device,
|
||||
userID string,
|
||||
roomID string,
|
||||
syncProducer *producers.SyncAPIProducer,
|
||||
) util.JSONResponse {
|
||||
|
||||
if device.UserID != userID {
|
||||
|
|
@ -71,6 +72,11 @@ func GetTags(
|
|||
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{
|
||||
Code: http.StatusOK,
|
||||
JSON: tagContent,
|
||||
|
|
@ -103,9 +109,9 @@ func PutTag(
|
|||
|
||||
var properties gomatrix.TagProperties
|
||||
|
||||
// if reqErr := httputil.UnmarshalJSONRequest(req, &properties); reqErr != nil {
|
||||
// return *reqErr
|
||||
// }
|
||||
if reqErr := httputil.UnmarshalJSONRequest(req, &properties); reqErr != nil {
|
||||
return *reqErr
|
||||
}
|
||||
|
||||
tagContent := newTag()
|
||||
var dataByte []byte
|
||||
|
|
@ -242,12 +248,3 @@ func saveTagData(
|
|||
|
||||
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 {
|
||||
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)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue