From f5039be461519d5eecf6e19637c568ca3463b4e1 Mon Sep 17 00:00:00 2001 From: santhoshivan23 Date: Sun, 4 Jun 2023 22:12:44 +0530 Subject: [PATCH] refactoring --- clientapi/routing/admin.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/clientapi/routing/admin.go b/clientapi/routing/admin.go index 24fbb79a8..60d6ec7dd 100644 --- a/clientapi/routing/admin.go +++ b/clientapi/routing/admin.go @@ -85,7 +85,9 @@ func AdminCreateNewRegistrationToken(req *http.Request, cfg *config.ClientAPI, r string(spec.ErrorInvalidParam), "expiry_time must not be in the past") } - created, err := rsAPI.PerformCreateToken(req.Context(), token, usesAllowed, expiryTime) + pending := 0 + completed := 0 + created, err := rsAPI.PerformAdminCreateRegistrationToken(req.Context(), token, usesAllowed, int32(pending), int32(completed), expiryTime) if err != nil { return util.MatrixErrorResponse( http.StatusInternalServerError, @@ -104,8 +106,8 @@ func AdminCreateNewRegistrationToken(req *http.Request, cfg *config.ClientAPI, r JSON: map[string]interface{}{ "token": token, "uses_allowed": usesAllowed, - "pending": 0, - "completed": 0, + "pending": pending, + "completed": completed, "expiry_time": expiryTime, }, }