From ce725b02c6adc4eb158e80939a94a2f331b96458 Mon Sep 17 00:00:00 2001
From: Andrei Mihu <andrei@heroiclabs.com>
Date: Fri, 6 May 2022 16:58:46 +0100
Subject: [PATCH] Correct naming of delete notifications before/after hook
 registration functions.

---
 CHANGELOG.md                                  |  1 +
 go.mod                                        |  2 +-
 go.sum                                        |  4 +-
 server/api_notification.go                    |  4 +-
 server/runtime.go                             | 48 +++++++++----------
 server/runtime_go.go                          | 12 ++---
 server/runtime_javascript.go                  |  8 ++--
 server/runtime_javascript_init.go             | 12 ++---
 server/runtime_lua.go                         |  8 ++--
 .../nakama-common/runtime/runtime.go          |  8 ++--
 vendor/modules.txt                            |  2 +-
 11 files changed, 55 insertions(+), 54 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1fd4aba0f..dae9f91f1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
 - Surface error message from Apple authentication JWT verification failures.
 - Improve user online status lookups.
 - Build with Go 1.18.1 release.
+- Correct naming of delete notifications before/after hook registration functions.
 
 ### Fixed
 - Fix data returned by StreamUserList in JS runtime.
diff --git a/go.mod b/go.mod
index 4e7aa52ab..59355ef03 100644
--- a/go.mod
+++ b/go.mod
@@ -13,7 +13,7 @@ require (
 	github.com/gorilla/mux v1.8.0
 	github.com/gorilla/websocket v1.4.2
 	github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0
-	github.com/heroiclabs/nakama-common v1.22.1-0.20220421143658-94ea09b04aff
+	github.com/heroiclabs/nakama-common v1.22.1-0.20220506145920-4c0b3c5a4a43
 	github.com/jackc/pgconn v1.10.0
 	github.com/jackc/pgerrcode v0.0.0-20201024163028-a0d42d470451
 	github.com/jackc/pgtype v1.8.1
diff --git a/go.sum b/go.sum
index afbf2b4e7..6e15fccac 100644
--- a/go.sum
+++ b/go.sum
@@ -255,8 +255,8 @@ github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHh
 github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
 github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
 github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
-github.com/heroiclabs/nakama-common v1.22.1-0.20220421143658-94ea09b04aff h1:o0b1y1lK0Vmkmta27L/2/zUzXgFcHGtgK+jatuuFWDk=
-github.com/heroiclabs/nakama-common v1.22.1-0.20220421143658-94ea09b04aff/go.mod h1:WF4YG46afwY3ibzsXnkt3zvhQ3tBY03IYeU7xSLr8HE=
+github.com/heroiclabs/nakama-common v1.22.1-0.20220506145920-4c0b3c5a4a43 h1:aNV5cSox9Bby8wClFmxVL7YjgzzyO/cXDrRvM4R3424=
+github.com/heroiclabs/nakama-common v1.22.1-0.20220506145920-4c0b3c5a4a43/go.mod h1:WF4YG46afwY3ibzsXnkt3zvhQ3tBY03IYeU7xSLr8HE=
 github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
 github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
 github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
diff --git a/server/api_notification.go b/server/api_notification.go
index cc523d31f..b1b63181b 100644
--- a/server/api_notification.go
+++ b/server/api_notification.go
@@ -99,7 +99,7 @@ func (s *ApiServer) DeleteNotifications(ctx context.Context, in *api.DeleteNotif
 	userID := ctx.Value(ctxUserIDKey{}).(uuid.UUID)
 
 	// Before hook.
-	if fn := s.runtime.BeforeDeleteNotification(); fn != nil {
+	if fn := s.runtime.BeforeDeleteNotifications(); fn != nil {
 		beforeFn := func(clientIP, clientPort string) error {
 			result, err, code := fn(ctx, s.logger, ctx.Value(ctxUserIDKey{}).(uuid.UUID).String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxVarsKey{}).(map[string]string), ctx.Value(ctxExpiryKey{}).(int64), clientIP, clientPort, in)
 			if err != nil {
@@ -130,7 +130,7 @@ func (s *ApiServer) DeleteNotifications(ctx context.Context, in *api.DeleteNotif
 	}
 
 	// After hook.
-	if fn := s.runtime.AfterDeleteNotification(); fn != nil {
+	if fn := s.runtime.AfterDeleteNotifications(); fn != nil {
 		afterFn := func(clientIP, clientPort string) error {
 			return fn(ctx, s.logger, ctx.Value(ctxUserIDKey{}).(uuid.UUID).String(), ctx.Value(ctxUsernameKey{}).(string), ctx.Value(ctxVarsKey{}).(map[string]string), ctx.Value(ctxExpiryKey{}).(int64), clientIP, clientPort, in)
 		}
diff --git a/server/runtime.go b/server/runtime.go
index c9a74fe9a..5ef3462d9 100644
--- a/server/runtime.go
+++ b/server/runtime.go
@@ -147,8 +147,8 @@ type (
 	RuntimeAfterListMatchesFunction                        func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.MatchList, in *api.ListMatchesRequest) error
 	RuntimeBeforeListNotificationsFunction                 func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListNotificationsRequest) (*api.ListNotificationsRequest, error, codes.Code)
 	RuntimeAfterListNotificationsFunction                  func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.NotificationList, in *api.ListNotificationsRequest) error
-	RuntimeBeforeDeleteNotificationFunction                func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) (*api.DeleteNotificationsRequest, error, codes.Code)
-	RuntimeAfterDeleteNotificationFunction                 func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) error
+	RuntimeBeforeDeleteNotificationsFunction               func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) (*api.DeleteNotificationsRequest, error, codes.Code)
+	RuntimeAfterDeleteNotificationsFunction                func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) error
 	RuntimeBeforeListStorageObjectsFunction                func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ListStorageObjectsRequest) (*api.ListStorageObjectsRequest, error, codes.Code)
 	RuntimeAfterListStorageObjectsFunction                 func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.StorageObjectList, in *api.ListStorageObjectsRequest) error
 	RuntimeBeforeReadStorageObjectsFunction                func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.ReadStorageObjectsRequest) (*api.ReadStorageObjectsRequest, error, codes.Code)
@@ -344,7 +344,7 @@ type RuntimeBeforeReqFunctions struct {
 	beforeLinkSteamFunction                         RuntimeBeforeLinkSteamFunction
 	beforeListMatchesFunction                       RuntimeBeforeListMatchesFunction
 	beforeListNotificationsFunction                 RuntimeBeforeListNotificationsFunction
-	beforeDeleteNotificationFunction                RuntimeBeforeDeleteNotificationFunction
+	beforeDeleteNotificationsFunction               RuntimeBeforeDeleteNotificationsFunction
 	beforeListStorageObjectsFunction                RuntimeBeforeListStorageObjectsFunction
 	beforeReadStorageObjectsFunction                RuntimeBeforeReadStorageObjectsFunction
 	beforeWriteStorageObjectsFunction               RuntimeBeforeWriteStorageObjectsFunction
@@ -419,7 +419,7 @@ type RuntimeAfterReqFunctions struct {
 	afterLinkSteamFunction                         RuntimeAfterLinkSteamFunction
 	afterListMatchesFunction                       RuntimeAfterListMatchesFunction
 	afterListNotificationsFunction                 RuntimeAfterListNotificationsFunction
-	afterDeleteNotificationFunction                RuntimeAfterDeleteNotificationFunction
+	afterDeleteNotificationsFunction               RuntimeAfterDeleteNotificationsFunction
 	afterListStorageObjectsFunction                RuntimeAfterListStorageObjectsFunction
 	afterReadStorageObjectsFunction                RuntimeAfterReadStorageObjectsFunction
 	afterWriteStorageObjectsFunction               RuntimeAfterWriteStorageObjectsFunction
@@ -818,8 +818,8 @@ func NewRuntime(ctx context.Context, logger, startupLogger *zap.Logger, db *sql.
 	if allBeforeReqFunctions.beforeListNotificationsFunction != nil {
 		startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "listnotifications"))
 	}
-	if allBeforeReqFunctions.beforeDeleteNotificationFunction != nil {
-		startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "deletenotification"))
+	if allBeforeReqFunctions.beforeDeleteNotificationsFunction != nil {
+		startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "deletenotifications"))
 	}
 	if allBeforeReqFunctions.beforeListStorageObjectsFunction != nil {
 		startupLogger.Info("Registered JavaScript runtime Before function invocation", zap.String("id", "liststorageobjects"))
@@ -1080,9 +1080,9 @@ func NewRuntime(ctx context.Context, logger, startupLogger *zap.Logger, db *sql.
 		allBeforeReqFunctions.beforeListNotificationsFunction = luaBeforeReqFunctions.beforeListNotificationsFunction
 		startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "listnotifications"))
 	}
-	if luaBeforeReqFunctions.beforeDeleteNotificationFunction != nil {
-		allBeforeReqFunctions.beforeDeleteNotificationFunction = luaBeforeReqFunctions.beforeDeleteNotificationFunction
-		startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "deletenotification"))
+	if luaBeforeReqFunctions.beforeDeleteNotificationsFunction != nil {
+		allBeforeReqFunctions.beforeDeleteNotificationsFunction = luaBeforeReqFunctions.beforeDeleteNotificationsFunction
+		startupLogger.Info("Registered Lua runtime Before function invocation", zap.String("id", "deletenotifications"))
 	}
 	if luaBeforeReqFunctions.beforeListStorageObjectsFunction != nil {
 		allBeforeReqFunctions.beforeListStorageObjectsFunction = luaBeforeReqFunctions.beforeListStorageObjectsFunction
@@ -1370,9 +1370,9 @@ func NewRuntime(ctx context.Context, logger, startupLogger *zap.Logger, db *sql.
 		allBeforeReqFunctions.beforeListNotificationsFunction = goBeforeReqFunctions.beforeListNotificationsFunction
 		startupLogger.Info("Registered Go runtime Before function invocation", zap.String("id", "listnotifications"))
 	}
-	if goBeforeReqFunctions.beforeDeleteNotificationFunction != nil {
-		allBeforeReqFunctions.beforeDeleteNotificationFunction = goBeforeReqFunctions.beforeDeleteNotificationFunction
-		startupLogger.Info("Registered Go runtime Before function invocation", zap.String("id", "deletenotification"))
+	if goBeforeReqFunctions.beforeDeleteNotificationsFunction != nil {
+		allBeforeReqFunctions.beforeDeleteNotificationsFunction = goBeforeReqFunctions.beforeDeleteNotificationsFunction
+		startupLogger.Info("Registered Go runtime Before function invocation", zap.String("id", "deletenotifications"))
 	}
 	if goBeforeReqFunctions.beforeListStorageObjectsFunction != nil {
 		allBeforeReqFunctions.beforeListStorageObjectsFunction = goBeforeReqFunctions.beforeListStorageObjectsFunction
@@ -1613,8 +1613,8 @@ func NewRuntime(ctx context.Context, logger, startupLogger *zap.Logger, db *sql.
 	if allAfterReqFunctions.afterListNotificationsFunction != nil {
 		startupLogger.Info("Registered JavaScript runtime After function invocation", zap.String("id", "listnotifications"))
 	}
-	if allAfterReqFunctions.afterDeleteNotificationFunction != nil {
-		startupLogger.Info("Registered JavaScript runtime After function invocation", zap.String("id", "deletenotification"))
+	if allAfterReqFunctions.afterDeleteNotificationsFunction != nil {
+		startupLogger.Info("Registered JavaScript runtime After function invocation", zap.String("id", "deletenotifications"))
 	}
 	if allAfterReqFunctions.afterListStorageObjectsFunction != nil {
 		startupLogger.Info("Registered JavaScript runtime After function invocation", zap.String("id", "liststorageobjects"))
@@ -1875,9 +1875,9 @@ func NewRuntime(ctx context.Context, logger, startupLogger *zap.Logger, db *sql.
 		allAfterReqFunctions.afterListNotificationsFunction = luaAfterReqFunctions.afterListNotificationsFunction
 		startupLogger.Info("Registered Lua runtime After function invocation", zap.String("id", "listnotifications"))
 	}
-	if luaAfterReqFunctions.afterDeleteNotificationFunction != nil {
-		allAfterReqFunctions.afterDeleteNotificationFunction = luaAfterReqFunctions.afterDeleteNotificationFunction
-		startupLogger.Info("Registered Lua runtime After function invocation", zap.String("id", "deletenotification"))
+	if luaAfterReqFunctions.afterDeleteNotificationsFunction != nil {
+		allAfterReqFunctions.afterDeleteNotificationsFunction = luaAfterReqFunctions.afterDeleteNotificationsFunction
+		startupLogger.Info("Registered Lua runtime After function invocation", zap.String("id", "deletenotifications"))
 	}
 	if luaAfterReqFunctions.afterListStorageObjectsFunction != nil {
 		allAfterReqFunctions.afterListStorageObjectsFunction = luaAfterReqFunctions.afterListStorageObjectsFunction
@@ -2165,9 +2165,9 @@ func NewRuntime(ctx context.Context, logger, startupLogger *zap.Logger, db *sql.
 		allAfterReqFunctions.afterListNotificationsFunction = goAfterReqFunctions.afterListNotificationsFunction
 		startupLogger.Info("Registered Go runtime After function invocation", zap.String("id", "listnotifications"))
 	}
-	if goAfterReqFunctions.afterDeleteNotificationFunction != nil {
-		allAfterReqFunctions.afterDeleteNotificationFunction = goAfterReqFunctions.afterDeleteNotificationFunction
-		startupLogger.Info("Registered Go runtime After function invocation", zap.String("id", "deletenotification"))
+	if goAfterReqFunctions.afterDeleteNotificationsFunction != nil {
+		allAfterReqFunctions.afterDeleteNotificationsFunction = goAfterReqFunctions.afterDeleteNotificationsFunction
+		startupLogger.Info("Registered Go runtime After function invocation", zap.String("id", "deletenotifications"))
 	}
 	if goAfterReqFunctions.afterListStorageObjectsFunction != nil {
 		allAfterReqFunctions.afterListStorageObjectsFunction = goAfterReqFunctions.afterListStorageObjectsFunction
@@ -2807,12 +2807,12 @@ func (r *Runtime) AfterListNotifications() RuntimeAfterListNotificationsFunction
 	return r.afterReqFunctions.afterListNotificationsFunction
 }
 
-func (r *Runtime) BeforeDeleteNotification() RuntimeBeforeDeleteNotificationFunction {
-	return r.beforeReqFunctions.beforeDeleteNotificationFunction
+func (r *Runtime) BeforeDeleteNotifications() RuntimeBeforeDeleteNotificationsFunction {
+	return r.beforeReqFunctions.beforeDeleteNotificationsFunction
 }
 
-func (r *Runtime) AfterDeleteNotification() RuntimeAfterDeleteNotificationFunction {
-	return r.afterReqFunctions.afterDeleteNotificationFunction
+func (r *Runtime) AfterDeleteNotifications() RuntimeAfterDeleteNotificationsFunction {
+	return r.afterReqFunctions.afterDeleteNotificationsFunction
 }
 
 func (r *Runtime) BeforeListStorageObjects() RuntimeBeforeListStorageObjectsFunction {
diff --git a/server/runtime_go.go b/server/runtime_go.go
index 14ecb9bac..55cfe39de 100644
--- a/server/runtime_go.go
+++ b/server/runtime_go.go
@@ -1560,10 +1560,10 @@ func (ri *RuntimeGoInitializer) RegisterAfterListNotifications(fn func(ctx conte
 	return nil
 }
 
-func (ri *RuntimeGoInitializer) RegisterBeforeDeleteNotification(fn func(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, in *api.DeleteNotificationsRequest) (*api.DeleteNotificationsRequest, error)) error {
-	ri.beforeReq.beforeDeleteNotificationFunction = func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) (*api.DeleteNotificationsRequest, error, codes.Code) {
+func (ri *RuntimeGoInitializer) RegisterBeforeDeleteNotifications(fn func(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, in *api.DeleteNotificationsRequest) (*api.DeleteNotificationsRequest, error)) error {
+	ri.beforeReq.beforeDeleteNotificationsFunction = func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) (*api.DeleteNotificationsRequest, error, codes.Code) {
 		ctx = NewRuntimeGoContext(ctx, ri.node, ri.env, RuntimeExecutionModeBefore, nil, nil, expiry, userID, username, vars, "", clientIP, clientPort, "")
-		loggerFields := map[string]interface{}{"api_id": "deletenotification", "mode": RuntimeExecutionModeBefore.String()}
+		loggerFields := map[string]interface{}{"api_id": "deletenotifications", "mode": RuntimeExecutionModeBefore.String()}
 		result, fnErr := fn(ctx, ri.logger.WithFields(loggerFields), ri.db, ri.nk, in)
 		if fnErr != nil {
 			if runtimeErr, ok := fnErr.(*runtime.Error); ok {
@@ -1581,10 +1581,10 @@ func (ri *RuntimeGoInitializer) RegisterBeforeDeleteNotification(fn func(ctx con
 	return nil
 }
 
-func (ri *RuntimeGoInitializer) RegisterAfterDeleteNotification(fn func(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, in *api.DeleteNotificationsRequest) error) error {
-	ri.afterReq.afterDeleteNotificationFunction = func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) error {
+func (ri *RuntimeGoInitializer) RegisterAfterDeleteNotifications(fn func(ctx context.Context, logger runtime.Logger, db *sql.DB, nk runtime.NakamaModule, in *api.DeleteNotificationsRequest) error) error {
+	ri.afterReq.afterDeleteNotificationsFunction = func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) error {
 		ctx = NewRuntimeGoContext(ctx, ri.node, ri.env, RuntimeExecutionModeAfter, nil, nil, expiry, userID, username, vars, "", clientIP, clientPort, "")
-		loggerFields := map[string]interface{}{"api_id": "deletenotification", "mode": RuntimeExecutionModeAfter.String()}
+		loggerFields := map[string]interface{}{"api_id": "deletenotifications", "mode": RuntimeExecutionModeAfter.String()}
 		return fn(ctx, ri.logger.WithFields(loggerFields), ri.db, ri.nk, in)
 	}
 	return nil
diff --git a/server/runtime_javascript.go b/server/runtime_javascript.go
index 0a2151f0d..8838282da 100644
--- a/server/runtime_javascript.go
+++ b/server/runtime_javascript.go
@@ -1015,8 +1015,8 @@ func NewRuntimeProviderJS(logger, startupLogger *zap.Logger, db *sql.DB, protojs
 						}
 						return result.(*api.ListNotificationsRequest), nil, 0
 					}
-				case "deletenotification":
-					beforeReqFunctions.beforeDeleteNotificationFunction = func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) (*api.DeleteNotificationsRequest, error, codes.Code) {
+				case "deletenotifications":
+					beforeReqFunctions.beforeDeleteNotificationsFunction = func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) (*api.DeleteNotificationsRequest, error, codes.Code) {
 						result, err, code := runtimeProviderJS.BeforeReq(ctx, id, logger, userID, username, vars, expiry, clientIP, clientPort, in)
 						if result == nil || err != nil {
 							return nil, err, code
@@ -1405,8 +1405,8 @@ func NewRuntimeProviderJS(logger, startupLogger *zap.Logger, db *sql.DB, protojs
 					afterReqFunctions.afterListNotificationsFunction = func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.NotificationList, in *api.ListNotificationsRequest) error {
 						return runtimeProviderJS.AfterReq(ctx, id, logger, userID, username, vars, expiry, clientIP, clientPort, out, in)
 					}
-				case "deletenotification":
-					afterReqFunctions.afterDeleteNotificationFunction = func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) error {
+				case "deletenotifications":
+					afterReqFunctions.afterDeleteNotificationsFunction = func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) error {
 						return runtimeProviderJS.AfterReq(ctx, id, logger, userID, username, vars, expiry, clientIP, clientPort, nil, in)
 					}
 				case "liststorageobjects":
diff --git a/server/runtime_javascript_init.go b/server/runtime_javascript_init.go
index a24444f01..3b4d72fd9 100644
--- a/server/runtime_javascript_init.go
+++ b/server/runtime_javascript_init.go
@@ -189,8 +189,8 @@ func (im *RuntimeJavascriptInitModule) mappings(r *goja.Runtime) map[string]func
 		"registerAfterListMatches":                        im.registerAfterListMatches(r),
 		"registerBeforeListNotifications":                 im.registerBeforeListNotifications(r),
 		"registerAfterListNotifications":                  im.registerAfterListNotifications(r),
-		"registerBeforeDeleteNotification":                im.registerBeforeDeleteNotification(r),
-		"registerAfterDeleteNotification":                 im.registerAfterDeleteNotification(r),
+		"registerBeforeDeleteNotifications":               im.registerBeforeDeleteNotifications(r),
+		"registerAfterDeleteNotifications":                im.registerAfterDeleteNotifications(r),
 		"registerBeforeListStorageObjects":                im.registerBeforeListStorageObjects(r),
 		"registerAfterListStorageObjects":                 im.registerAfterListStorageObjects(r),
 		"registerBeforeReadStorageObjects":                im.registerBeforeReadStorageObjects(r),
@@ -705,12 +705,12 @@ func (im *RuntimeJavascriptInitModule) registerAfterListNotifications(r *goja.Ru
 	return im.registerHook(r, RuntimeExecutionModeAfter, "registerAfterListNotifications", "listnotifications")
 }
 
-func (im *RuntimeJavascriptInitModule) registerBeforeDeleteNotification(r *goja.Runtime) func(goja.FunctionCall) goja.Value {
-	return im.registerHook(r, RuntimeExecutionModeBefore, "registerBeforeDeleteNotification", "deletenotification")
+func (im *RuntimeJavascriptInitModule) registerBeforeDeleteNotifications(r *goja.Runtime) func(goja.FunctionCall) goja.Value {
+	return im.registerHook(r, RuntimeExecutionModeBefore, "registerBeforeDeleteNotifications", "deletenotifications")
 }
 
-func (im *RuntimeJavascriptInitModule) registerAfterDeleteNotification(r *goja.Runtime) func(goja.FunctionCall) goja.Value {
-	return im.registerHook(r, RuntimeExecutionModeAfter, "registerAfterDeleteNotification", "deletenotification")
+func (im *RuntimeJavascriptInitModule) registerAfterDeleteNotifications(r *goja.Runtime) func(goja.FunctionCall) goja.Value {
+	return im.registerHook(r, RuntimeExecutionModeAfter, "registerAfterDeleteNotifications", "deletenotifications")
 }
 
 func (im *RuntimeJavascriptInitModule) registerBeforeListStorageObjects(r *goja.Runtime) func(goja.FunctionCall) goja.Value {
diff --git a/server/runtime_lua.go b/server/runtime_lua.go
index 3bf9b870d..de09a4d5d 100644
--- a/server/runtime_lua.go
+++ b/server/runtime_lua.go
@@ -552,8 +552,8 @@ func NewRuntimeProviderLua(logger, startupLogger *zap.Logger, db *sql.DB, protoj
 						}
 						return result.(*api.ListNotificationsRequest), nil, 0
 					}
-				case "deletenotification":
-					beforeReqFunctions.beforeDeleteNotificationFunction = func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) (*api.DeleteNotificationsRequest, error, codes.Code) {
+				case "deletenotifications":
+					beforeReqFunctions.beforeDeleteNotificationsFunction = func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) (*api.DeleteNotificationsRequest, error, codes.Code) {
 						result, err, code := runtimeProviderLua.BeforeReq(ctx, id, logger, userID, username, vars, expiry, clientIP, clientPort, in)
 						if result == nil || err != nil {
 							return nil, err, code
@@ -942,8 +942,8 @@ func NewRuntimeProviderLua(logger, startupLogger *zap.Logger, db *sql.DB, protoj
 					afterReqFunctions.afterListNotificationsFunction = func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, out *api.NotificationList, in *api.ListNotificationsRequest) error {
 						return runtimeProviderLua.AfterReq(ctx, id, logger, userID, username, vars, expiry, clientIP, clientPort, out, in)
 					}
-				case "deletenotification":
-					afterReqFunctions.afterDeleteNotificationFunction = func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) error {
+				case "deletenotifications":
+					afterReqFunctions.afterDeleteNotificationsFunction = func(ctx context.Context, logger *zap.Logger, userID, username string, vars map[string]string, expiry int64, clientIP, clientPort string, in *api.DeleteNotificationsRequest) error {
 						return runtimeProviderLua.AfterReq(ctx, id, logger, userID, username, vars, expiry, clientIP, clientPort, nil, in)
 					}
 				case "liststorageobjects":
diff --git a/vendor/github.com/heroiclabs/nakama-common/runtime/runtime.go b/vendor/github.com/heroiclabs/nakama-common/runtime/runtime.go
index bbff995cb..157d0840c 100644
--- a/vendor/github.com/heroiclabs/nakama-common/runtime/runtime.go
+++ b/vendor/github.com/heroiclabs/nakama-common/runtime/runtime.go
@@ -633,11 +633,11 @@ type Initializer interface {
 	// RegisterAfterListNotifications can be used to perform additional logic after listing notifications for a user.
 	RegisterAfterListNotifications(fn func(ctx context.Context, logger Logger, db *sql.DB, nk NakamaModule, out *api.NotificationList, in *api.ListNotificationsRequest) error) error
 
-	// RegisterBeforeDeleteNotification can be used to perform additional logic before deleting notifications.
-	RegisterBeforeDeleteNotification(fn func(ctx context.Context, logger Logger, db *sql.DB, nk NakamaModule, in *api.DeleteNotificationsRequest) (*api.DeleteNotificationsRequest, error)) error
+	// RegisterBeforeDeleteNotifications can be used to perform additional logic before deleting notifications.
+	RegisterBeforeDeleteNotifications(fn func(ctx context.Context, logger Logger, db *sql.DB, nk NakamaModule, in *api.DeleteNotificationsRequest) (*api.DeleteNotificationsRequest, error)) error
 
-	// RegisterAfterDeleteNotification can be used to perform additional logic after deleting notifications.
-	RegisterAfterDeleteNotification(fn func(ctx context.Context, logger Logger, db *sql.DB, nk NakamaModule, in *api.DeleteNotificationsRequest) error) error
+	// RegisterAfterDeleteNotifications can be used to perform additional logic after deleting notifications.
+	RegisterAfterDeleteNotifications(fn func(ctx context.Context, logger Logger, db *sql.DB, nk NakamaModule, in *api.DeleteNotificationsRequest) error) error
 
 	// RegisterBeforeListStorageObjects can be used to perform additional logic before listing storage objects.
 	RegisterBeforeListStorageObjects(fn func(ctx context.Context, logger Logger, db *sql.DB, nk NakamaModule, in *api.ListStorageObjectsRequest) (*api.ListStorageObjectsRequest, error)) error
diff --git a/vendor/modules.txt b/vendor/modules.txt
index ac34ad81a..22d827164 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -139,7 +139,7 @@ github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/internal/genopena
 github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options
 github.com/grpc-ecosystem/grpc-gateway/v2/runtime
 github.com/grpc-ecosystem/grpc-gateway/v2/utilities
-# github.com/heroiclabs/nakama-common v1.22.1-0.20220421143658-94ea09b04aff
+# github.com/heroiclabs/nakama-common v1.22.1-0.20220506145920-4c0b3c5a4a43
 ## explicit; go 1.14
 github.com/heroiclabs/nakama-common/api
 github.com/heroiclabs/nakama-common/rtapi
-- 
GitLab