aboutsummaryrefslogtreecommitdiff
path: root/clientapi/routing/aliases.go
diff options
context:
space:
mode:
authorkegsay <kegan@matrix.org>2023-05-02 15:03:16 +0100
committerGitHub <noreply@github.com>2023-05-02 15:03:16 +0100
commitf5b3144dc33ddcb2ab161323d422cab257d04b4c (patch)
tree07d3b03944d2529d96c29674a96c3e76a76ae3b9 /clientapi/routing/aliases.go
parent696cbb70b8cc8d663f7bb7c7a5f25cd57ea6803e (diff)
Use PDU not *Event in HeaderedEvent (#3073)
Requires https://github.com/matrix-org/gomatrixserverlib/pull/376 This has numerous upsides: - Less type casting to `*Event` is required. - Making Dendrite work with `PDU` interfaces means we can swap out Event impls more easily. - Tests which represent weird event shapes are easier to write. Part of a series of refactors on GMSL.
Diffstat (limited to 'clientapi/routing/aliases.go')
-rw-r--r--clientapi/routing/aliases.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/clientapi/routing/aliases.go b/clientapi/routing/aliases.go
index 90621daf..5c2df79d 100644
--- a/clientapi/routing/aliases.go
+++ b/clientapi/routing/aliases.go
@@ -15,6 +15,7 @@
package routing
import (
+ "encoding/json"
"fmt"
"net/http"
@@ -48,11 +49,12 @@ func GetAliases(
visibility := gomatrixserverlib.HistoryVisibilityInvited
if historyVisEvent, ok := stateRes.StateEvents[stateTuple]; ok {
var err error
- visibility, err = historyVisEvent.HistoryVisibility()
- if err != nil {
+ var content gomatrixserverlib.HistoryVisibilityContent
+ if err = json.Unmarshal(historyVisEvent.Content(), &content); err != nil {
util.GetLogger(req.Context()).WithError(err).Error("historyVisEvent.HistoryVisibility failed")
return util.ErrorResponse(fmt.Errorf("historyVisEvent.HistoryVisibility: %w", err))
}
+ visibility = content.HistoryVisibility
}
if visibility != spec.WorldReadable {
queryReq := api.QueryMembershipForUserRequest{