From e2251199a49ab0bb846c02ba37e1cd437a7f725b Mon Sep 17 00:00:00 2001 From: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Date: Fri, 12 Jul 2019 16:43:01 +0100 Subject: [PATCH] Lots of small typo fixes (#737) --- appservice/api/query.go | 4 ++-- clientapi/routing/createroom.go | 2 +- clientapi/routing/membership.go | 2 +- clientapi/routing/profile.go | 6 +++--- federationapi/routing/profile.go | 2 +- federationapi/routing/threepid.go | 2 +- go.sum | 1 - syncapi/storage/output_room_events_table.go | 2 +- typingserver/cache/cache.go | 11 ++++++----- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/appservice/api/query.go b/appservice/api/query.go index 9ec21448..8ce3b4e0 100644 --- a/appservice/api/query.go +++ b/appservice/api/query.go @@ -134,9 +134,9 @@ func (h *httpAppServiceQueryAPI) UserIDExists( return commonHTTP.PostJSON(ctx, span, h.httpClient, apiURL, request, response) } -// RetreiveUserProfile is a wrapper that queries both the local database and +// RetrieveUserProfile is a wrapper that queries both the local database and // application services for a given user's profile -func RetreiveUserProfile( +func RetrieveUserProfile( ctx context.Context, userID string, asAPI AppServiceQueryAPI, diff --git a/clientapi/routing/createroom.go b/clientapi/routing/createroom.go index a7187c49..220ba6ae 100644 --- a/clientapi/routing/createroom.go +++ b/clientapi/routing/createroom.go @@ -163,7 +163,7 @@ func createRoom( "roomID": roomID, }).Info("Creating new room") - profile, err := appserviceAPI.RetreiveUserProfile(req.Context(), userID, asAPI, accountDB) + profile, err := appserviceAPI.RetrieveUserProfile(req.Context(), userID, asAPI, accountDB) if err != nil { return httputil.LogThenError(req, err) } diff --git a/clientapi/routing/membership.go b/clientapi/routing/membership.go index 22e66f45..61898fec 100644 --- a/clientapi/routing/membership.go +++ b/clientapi/routing/membership.go @@ -176,7 +176,7 @@ func loadProfile( var profile *authtypes.Profile if serverName == cfg.Matrix.ServerName { - profile, err = appserviceAPI.RetreiveUserProfile(ctx, userID, asAPI, accountDB) + profile, err = appserviceAPI.RetrieveUserProfile(ctx, userID, asAPI, accountDB) } else { profile = &authtypes.Profile{} } diff --git a/clientapi/routing/profile.go b/clientapi/routing/profile.go index e57d16fb..eb1acab7 100644 --- a/clientapi/routing/profile.go +++ b/clientapi/routing/profile.go @@ -43,7 +43,7 @@ func GetProfile( JSON: jsonerror.NotFound("Bad method"), } } - profile, err := appserviceAPI.RetreiveUserProfile(req.Context(), userID, asAPI, accountDB) + profile, err := appserviceAPI.RetrieveUserProfile(req.Context(), userID, asAPI, accountDB) if err != nil { return httputil.LogThenError(req, err) } @@ -62,7 +62,7 @@ func GetProfile( func GetAvatarURL( req *http.Request, accountDB *accounts.Database, userID string, asAPI appserviceAPI.AppServiceQueryAPI, ) util.JSONResponse { - profile, err := appserviceAPI.RetreiveUserProfile(req.Context(), userID, asAPI, accountDB) + profile, err := appserviceAPI.RetrieveUserProfile(req.Context(), userID, asAPI, accountDB) if err != nil { return httputil.LogThenError(req, err) } @@ -160,7 +160,7 @@ func SetAvatarURL( func GetDisplayName( req *http.Request, accountDB *accounts.Database, userID string, asAPI appserviceAPI.AppServiceQueryAPI, ) util.JSONResponse { - profile, err := appserviceAPI.RetreiveUserProfile(req.Context(), userID, asAPI, accountDB) + profile, err := appserviceAPI.RetrieveUserProfile(req.Context(), userID, asAPI, accountDB) if err != nil { return httputil.LogThenError(req, err) } diff --git a/federationapi/routing/profile.go b/federationapi/routing/profile.go index aa4fcdc4..2b478cfb 100644 --- a/federationapi/routing/profile.go +++ b/federationapi/routing/profile.go @@ -53,7 +53,7 @@ func GetProfile( return httputil.LogThenError(httpReq, err) } - profile, err := appserviceAPI.RetreiveUserProfile(httpReq.Context(), userID, asAPI, accountDB) + profile, err := appserviceAPI.RetrieveUserProfile(httpReq.Context(), userID, asAPI, accountDB) if err != nil { return httputil.LogThenError(httpReq, err) } diff --git a/federationapi/routing/threepid.go b/federationapi/routing/threepid.go index 27796067..05ca8892 100644 --- a/federationapi/routing/threepid.go +++ b/federationapi/routing/threepid.go @@ -194,7 +194,7 @@ func createInviteFrom3PIDInvite( StateKey: &inv.MXID, } - profile, err := appserviceAPI.RetreiveUserProfile(ctx, inv.MXID, asAPI, accountDB) + profile, err := appserviceAPI.RetrieveUserProfile(ctx, inv.MXID, asAPI, accountDB) if err != nil { return nil, err } diff --git a/go.sum b/go.sum index ce3c07dd..ef6e94e1 100644 --- a/go.sum +++ b/go.sum @@ -140,4 +140,3 @@ gopkg.in/yaml.v2 v2.0.0-20171116090243-287cf08546ab h1:yZ6iByf7GKeJ3gsd1Dr/xaj1D gopkg.in/yaml.v2 v2.0.0-20171116090243-287cf08546ab/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= - diff --git a/syncapi/storage/output_room_events_table.go b/syncapi/storage/output_room_events_table.go index 06df017c..34632aed 100644 --- a/syncapi/storage/output_room_events_table.go +++ b/syncapi/storage/output_room_events_table.go @@ -235,7 +235,7 @@ func (s *outputRoomEventsStatements) selectRecentEvents( return nil, err } // The events need to be returned from oldest to latest, which isn't - // necessary the way the SQL query returns them, so a sort is necessary to + // necessarily the way the SQL query returns them, so a sort is necessary to // ensure the events are in the right order in the slice. sort.SliceStable(events, func(i int, j int) bool { return events[i].streamPosition < events[j].streamPosition diff --git a/typingserver/cache/cache.go b/typingserver/cache/cache.go index 8d84f856..3f05c938 100644 --- a/typingserver/cache/cache.go +++ b/typingserver/cache/cache.go @@ -127,11 +127,12 @@ func (t *TypingCache) addUser( // Stop the timer to cancel the call to timeoutCallback if timer, ok := t.data[roomID].userSet[userID]; ok { - // It may happen that at this stage timer fires but now we have a lock on t. - // Hence the execution of timeoutCallback will happen after we unlock. - // So we may lose a typing state, though this event is highly unlikely. - // This can be mitigated by keeping another time.Time in the map and check against it - // before removing. This however is not required in most practical scenario. + // It may happen that at this stage the timer fires, but we now have a lock on + // it. Hence the execution of timeoutCallback will happen after we unlock. So + // we may lose a typing state, though this is highly unlikely. This can be + // mitigated by keeping another time.Time in the map and checking against it + // before removing, but its occurrence is so infrequent it does not seem + // worthwhile. timer.Stop() }