aboutsummaryrefslogtreecommitdiff
path: root/syncapi
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2022-08-05 11:12:41 +0200
committerGitHub <noreply@github.com>2022-08-05 11:12:41 +0200
commit1b7f84250a46b401eccb89acafdef1b379f2dbc0 (patch)
treec2b9bfd996dddda3236af6299c603d8541f5f64b /syncapi
parentde78eab63a99653edf68f783e263688ad4b701d8 (diff)
Fix linter issues (#2624)
* Try that again * All hail the mighty linter? * And once again * goimport all the things
Diffstat (limited to 'syncapi')
-rw-r--r--syncapi/internal/keychange_test.go20
-rw-r--r--syncapi/routing/filter.go11
-rw-r--r--syncapi/storage/tables/interface.go17
3 files changed, 28 insertions, 20 deletions
diff --git a/syncapi/internal/keychange_test.go b/syncapi/internal/keychange_test.go
index 6bfc91ed..c7d8df74 100644
--- a/syncapi/internal/keychange_test.go
+++ b/syncapi/internal/keychange_test.go
@@ -6,12 +6,13 @@ import (
"sort"
"testing"
+ "github.com/matrix-org/gomatrixserverlib"
+ "github.com/matrix-org/util"
+
keyapi "github.com/matrix-org/dendrite/keyserver/api"
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/syncapi/types"
userapi "github.com/matrix-org/dendrite/userapi/api"
- "github.com/matrix-org/gomatrixserverlib"
- "github.com/matrix-org/util"
)
var (
@@ -364,13 +365,14 @@ func TestKeyChangeCatchupChangeAndLeft(t *testing.T) {
// tests that joining/leaving the SAME room puts users in `left` if the final state is leave.
// NB: Consider the case:
-// - Alice and Bob are in a room.
-// - Alice goes offline, Charlie joins, sends encrypted messages then leaves the room.
-// - Alice comes back online. Technically nothing has changed in the set of users between those two points in time,
-// it's still just (Alice,Bob) but then we won't be tracking Charlie -- is this okay though? It's device keys
-// which are only relevant when actively sending events I think? And if Alice does need the keys she knows
-// charlie's (user_id, device_id) so can just hit /keys/query - no need to keep updated about it because she
-// doesn't share any rooms with him.
+// - Alice and Bob are in a room.
+// - Alice goes offline, Charlie joins, sends encrypted messages then leaves the room.
+// - Alice comes back online. Technically nothing has changed in the set of users between those two points in time,
+// it's still just (Alice,Bob) but then we won't be tracking Charlie -- is this okay though? It's device keys
+// which are only relevant when actively sending events I think? And if Alice does need the keys she knows
+// charlie's (user_id, device_id) so can just hit /keys/query - no need to keep updated about it because she
+// doesn't share any rooms with him.
+//
// Ergo, we put them in `left` as it is simpler.
func TestKeyChangeCatchupChangeAndLeftSameRoom(t *testing.T) {
newShareUser := "@berta:localhost"
diff --git a/syncapi/routing/filter.go b/syncapi/routing/filter.go
index 1a10bd64..b41714df 100644
--- a/syncapi/routing/filter.go
+++ b/syncapi/routing/filter.go
@@ -19,13 +19,14 @@ import (
"io/ioutil"
"net/http"
+ "github.com/matrix-org/gomatrixserverlib"
+ "github.com/matrix-org/util"
+ "github.com/tidwall/gjson"
+
"github.com/matrix-org/dendrite/clientapi/jsonerror"
"github.com/matrix-org/dendrite/syncapi/storage"
"github.com/matrix-org/dendrite/syncapi/sync"
"github.com/matrix-org/dendrite/userapi/api"
- "github.com/matrix-org/gomatrixserverlib"
- "github.com/matrix-org/util"
- "github.com/tidwall/gjson"
)
// GetFilter implements GET /_matrix/client/r0/user/{userId}/filter/{filterId}
@@ -65,7 +66,9 @@ type filterResponse struct {
FilterID string `json:"filter_id"`
}
-//PutFilter implements POST /_matrix/client/r0/user/{userId}/filter
+// PutFilter implements
+//
+// POST /_matrix/client/r0/user/{userId}/filter
func PutFilter(
req *http.Request, device *api.Device, syncDB storage.Database, userID string,
) util.JSONResponse {
diff --git a/syncapi/storage/tables/interface.go b/syncapi/storage/tables/interface.go
index d8fc8f50..d68351d4 100644
--- a/syncapi/storage/tables/interface.go
+++ b/syncapi/storage/tables/interface.go
@@ -18,10 +18,11 @@ import (
"context"
"database/sql"
+ "github.com/matrix-org/gomatrixserverlib"
+
"github.com/matrix-org/dendrite/internal/eventutil"
"github.com/matrix-org/dendrite/roomserver/api"
"github.com/matrix-org/dendrite/syncapi/types"
- "github.com/matrix-org/gomatrixserverlib"
)
type AccountData interface {
@@ -122,12 +123,14 @@ type CurrentRoomState interface {
//
// We persist the previous event IDs as well, one per row, so when we do fetch even
// earlier events we can simply delete rows which referenced it. Consider the graph:
-// A
-// | Event C has 1 prev_event ID: A.
-// B C
-// |___| Event D has 2 prev_event IDs: B and C.
-// |
-// D
+//
+// A
+// | Event C has 1 prev_event ID: A.
+// B C
+// |___| Event D has 2 prev_event IDs: B and C.
+// |
+// D
+//
// The earliest known event we have is D, so this table has 2 rows.
// A backfill request gives us C but not B. We delete rows where prev_event=C. This
// still means that D is a backwards extremity as we do not have event B. However, event