aboutsummaryrefslogtreecommitdiff
path: root/setup
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2022-03-24 10:03:22 +0000
committerNeil Alexander <neilalexander@users.noreply.github.com>2022-03-24 10:03:22 +0000
commitd983d17355584b7de086389e069a935f1a5510a1 (patch)
tree0920bd8f9a5f64ac749397cf012904b8275a6d52 /setup
parent6c95f9b535191bc28cb983a6fa0eab036dc40916 (diff)
Fix lint errors
Diffstat (limited to 'setup')
-rw-r--r--setup/mscs/msc2946/msc2946.go33
1 files changed, 6 insertions, 27 deletions
diff --git a/setup/mscs/msc2946/msc2946.go b/setup/mscs/msc2946/msc2946.go
index 7fb04336..61520d50 100644
--- a/setup/mscs/msc2946/msc2946.go
+++ b/setup/mscs/msc2946/msc2946.go
@@ -283,11 +283,7 @@ func (w *walker) walk() util.JSONResponse {
if !roomExists {
// attempt to query this room over federation, as either we've never heard of it before
// or we've left it and hence are not authorised (but info may be exposed regardless)
- fedRes, err := w.federatedRoomInfo(rv.roomID, rv.vias)
- if err != nil {
- util.GetLogger(w.ctx).WithError(err).WithField("room_id", rv.roomID).Errorf("failed to query federated spaces")
- continue
- }
+ fedRes := w.federatedRoomInfo(rv.roomID, rv.vias)
if fedRes != nil {
discoveredChildEvents = fedRes.Room.ChildrenState
discoveredRooms = append(discoveredRooms, fedRes.Room)
@@ -420,15 +416,15 @@ func (w *walker) publicRoomsChunk(roomID string) *gomatrixserverlib.PublicRoom {
// federatedRoomInfo returns more of the spaces graph from another server. Returns nil if this was
// unsuccessful.
-func (w *walker) federatedRoomInfo(roomID string, vias []string) (*gomatrixserverlib.MSC2946SpacesResponse, error) {
+func (w *walker) federatedRoomInfo(roomID string, vias []string) *gomatrixserverlib.MSC2946SpacesResponse {
// only do federated requests for client requests
if w.caller == nil {
- return nil, nil
+ return nil
}
resp, ok := w.cache.GetSpaceSummary(roomID)
if ok {
util.GetLogger(w.ctx).Debugf("Returning cached response for %s", roomID)
- return &resp, nil
+ return &resp
}
util.GetLogger(w.ctx).Debugf("Querying %s via %+v", roomID, vias)
ctx := context.Background()
@@ -455,9 +451,9 @@ func (w *walker) federatedRoomInfo(roomID string, vias []string) (*gomatrixserve
}
w.cache.StoreSpaceSummary(roomID, res)
- return &res, nil
+ return &res
}
- return nil, nil
+ return nil
}
func (w *walker) roomExists(roomID string) bool {
@@ -717,23 +713,6 @@ func stripped(ev *gomatrixserverlib.Event) *gomatrixserverlib.MSC2946StrippedEve
}
}
-func eventKey(event *gomatrixserverlib.MSC2946StrippedEvent) string {
- return event.RoomID + "|" + event.Type + "|" + event.StateKey
-}
-
-func spaceTargetStripped(event *gomatrixserverlib.MSC2946StrippedEvent) string {
- if event.StateKey == "" {
- return "" // no-op
- }
- switch event.Type {
- case ConstSpaceParentEventType:
- return event.StateKey
- case ConstSpaceChildEventType:
- return event.StateKey
- }
- return ""
-}
-
func parseInt(intstr string, defaultVal int) int {
i, err := strconv.ParseInt(intstr, 10, 32)
if err != nil {