@@ -121,14 +121,14 @@ func (s *syncUserAPI) PerformLastSeenUpdate(ctx context.Context, req *userapi.Pe
121121}
122122
123123type userVerifier struct {
124- m map [string ]struct {
124+ accessTokenToDeviceAndResponse map [string ]struct {
125125 Device * userapi.Device
126126 Response * util.JSONResponse
127127 }
128128}
129129
130130func (u * userVerifier ) VerifyUserFromRequest (req * http.Request ) (* userapi.Device , * util.JSONResponse ) {
131- if pair , ok := u .m [req .URL .Query ().Get ("access_token" )]; ok {
131+ if pair , ok := u .accessTokenToDeviceAndResponse [req .URL .Query ().Get ("access_token" )]; ok {
132132 return pair .Device , pair .Response
133133 }
134134 return nil , nil
@@ -212,13 +212,13 @@ func testSyncAccessTokens(t *testing.T, dbType test.DBType) {
212212 },
213213 }
214214
215- uv .m = make (map [string ]struct {
215+ uv .accessTokenToDeviceAndResponse = make (map [string ]struct {
216216 Device * userapi.Device
217217 Response * util.JSONResponse
218218 }, len (testCases ))
219219 for _ , tc := range testCases {
220220
221- uv .m [tc .req .URL .Query ().Get ("access_token" )] = struct {
221+ uv .accessTokenToDeviceAndResponse [tc .req .URL .Query ().Get ("access_token" )] = struct {
222222 Device * userapi.Device
223223 Response * util.JSONResponse
224224 }{Device : tc .device , Response : tc .response }
@@ -285,7 +285,7 @@ func testSyncEventFormatPowerLevels(t *testing.T, dbType test.DBType) {
285285 caches := caching .NewRistrettoCache (128 * 1024 * 1024 , time .Hour , caching .DisableMetrics )
286286 natsInstance := jetstream.NATSInstance {}
287287 uv := userVerifier {
288- m : map [string ]struct {
288+ accessTokenToDeviceAndResponse : map [string ]struct {
289289 Device * userapi.Device
290290 Response * util.JSONResponse
291291 }{
@@ -539,7 +539,7 @@ func testSyncAPIUpdatePresenceImmediately(t *testing.T, dbType test.DBType) {
539539 jsctx , _ := natsInstance .Prepare (processCtx , & cfg .Global .JetStream )
540540 defer jetstream .DeleteAllStreams (jsctx , & cfg .Global .JetStream )
541541 uv := userVerifier {
542- m : map [string ]struct {
542+ accessTokenToDeviceAndResponse : map [string ]struct {
543543 Device * userapi.Device
544544 Response * util.JSONResponse
545545 }{
@@ -669,7 +669,7 @@ func testHistoryVisibility(t *testing.T, dbType test.DBType) {
669669 rsAPI := roomserver .NewInternalAPI (processCtx , cfg , cm , & natsInstance , caches , caching .DisableMetrics )
670670 rsAPI .SetFederationAPI (nil , nil )
671671 uv := userVerifier {
672- m : map [string ]struct {
672+ accessTokenToDeviceAndResponse : map [string ]struct {
673673 Device * userapi.Device
674674 Response * util.JSONResponse
675675 }{
@@ -947,7 +947,7 @@ func TestGetMembership(t *testing.T) {
947947 rsAPI := roomserver .NewInternalAPI (processCtx , cfg , cm , & natsInstance , caches , caching .DisableMetrics )
948948 rsAPI .SetFederationAPI (nil , nil )
949949 uv := userVerifier {
950- m : map [string ]struct {
950+ accessTokenToDeviceAndResponse : map [string ]struct {
951951 Device * userapi.Device
952952 Response * util.JSONResponse
953953 }{
@@ -1024,7 +1024,7 @@ func testSendToDevice(t *testing.T, dbType test.DBType) {
10241024 defer close ()
10251025 natsInstance := jetstream.NATSInstance {}
10261026 uv := userVerifier {
1027- m : map [string ]struct {
1027+ accessTokenToDeviceAndResponse : map [string ]struct {
10281028 Device * userapi.Device
10291029 Response * util.JSONResponse
10301030 }{
@@ -1258,7 +1258,7 @@ func testContext(t *testing.T, dbType test.DBType) {
12581258 rsAPI .SetFederationAPI (nil , nil )
12591259
12601260 uv := userVerifier {
1261- m : map [string ]struct {
1261+ accessTokenToDeviceAndResponse : map [string ]struct {
12621262 Device * userapi.Device
12631263 Response * util.JSONResponse
12641264 }{
@@ -1446,7 +1446,7 @@ func TestRemoveEditedEventFromSearchIndex(t *testing.T) {
14461446 rsAPI := roomserver .NewInternalAPI (processCtx , cfg , cm , & natsInstance , caches , caching .DisableMetrics )
14471447 rsAPI .SetFederationAPI (nil , nil )
14481448 uv := userVerifier {
1449- m : map [string ]struct {
1449+ accessTokenToDeviceAndResponse : map [string ]struct {
14501450 Device * userapi.Device
14511451 Response * util.JSONResponse
14521452 }{
0 commit comments