From a304a8b67e89c8d1655a5ba87d2b7abbf0f5fcaa Mon Sep 17 00:00:00 2001 From: Anant Prakash Date: Mon, 5 Mar 2018 20:24:01 +0530 Subject: [PATCH] Replace Set method with AddCompletedStage Signed-off-by: Anant Prakash --- .../matrix-org/dendrite/clientapi/routing/register.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/clientapi/routing/register.go b/src/github.com/matrix-org/dendrite/clientapi/routing/register.go index 9a9f549ba..09c8c4e1d 100644 --- a/src/github.com/matrix-org/dendrite/clientapi/routing/register.go +++ b/src/github.com/matrix-org/dendrite/clientapi/routing/register.go @@ -61,8 +61,8 @@ func (d sessionsDict) Get(key string) []authtypes.LoginType { return make([]authtypes.LoginType, 0) } -func (d *sessionsDict) Set(key string, v []authtypes.LoginType) { - d.sessions[key] = v +func (d *sessionsDict) AddCompletedStage(key string, v authtypes.LoginType) { + d.sessions[key] = append(d.Get(key), v) } var ( @@ -450,7 +450,7 @@ func handleRegistrationFlow( } // Add Recaptcha to the list of completed registration stages - sessions.Set(sessionID, append(sessions.Get(sessionID), authtypes.LoginTypeRecaptcha)) + sessions.AddCompletedStage(sessionID, authtypes.LoginTypeRecaptcha) case authtypes.LoginTypeSharedSecret: // Check shared secret against config @@ -463,7 +463,7 @@ func handleRegistrationFlow( } // Add SharedSecret to the list of completed registration stages - sessions.Set(sessionID, append(sessions.Get(sessionID), authtypes.LoginTypeSharedSecret)) + sessions.AddCompletedStage(sessionID, authtypes.LoginTypeSharedSecret) case authtypes.LoginTypeApplicationService: // Check Application Service register user request is valid. @@ -483,7 +483,7 @@ func handleRegistrationFlow( case authtypes.LoginTypeDummy: // there is nothing to do // Add Dummy to the list of completed registration stages - sessions.Set(sessionID, append(sessions.Get(sessionID), authtypes.LoginTypeDummy)) + sessions.AddCompletedStage(sessionID, authtypes.LoginTypeDummy) default: return util.JSONResponse{