From ed449d797869f49348df28a605617fd96289c2a5 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Fri, 12 Jul 2019 15:56:04 +0100 Subject: [PATCH] Lots of small typo fixes --- 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 +- syncapi/storage/output_room_events_table.go | 2 +- typingserver/cache/cache.go | 11 ++++++----- 8 files changed, 16 insertions(+), 15 deletions(-) diff --git a/appservice/api/query.go b/appservice/api/query.go index 9ec214486..8ce3b4e04 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 a7187c495..220ba6ae8 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 22e66f452..61898fecd 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 e57d16fbf..eb1acab74 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 aa4fcdc42..2b478cfbf 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 27796067b..05ca8892e 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/syncapi/storage/output_room_events_table.go b/syncapi/storage/output_room_events_table.go index 035db9882..505732a1b 100644 --- a/syncapi/storage/output_room_events_table.go +++ b/syncapi/storage/output_room_events_table.go @@ -236,7 +236,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 85d74cd19..8f862c029 100644 --- a/typingserver/cache/cache.go +++ b/typingserver/cache/cache.go @@ -70,11 +70,12 @@ func (t *TypingCache) addUser(userID, roomID string, expiryTimer *time.Timer) { // Stop the timer to cancel the call to timeoutCallback if timer, ok := t.data[roomID][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() }