Commit 2744ebb0 authored by Simon Esposito's avatar Simon Esposito
Browse files

Fix JS runtime multiUpdate function

parent d53c1225
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -5,6 +5,9 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr

## [Unreleased]

### Fixed
- Fix an issue with the JS runtime multiUpdate function.

## [3.0.0] - 2021-01-16

This is a major release of the server but **fully backwards compatible** with the 2.x releases.
+176 −176
Original line number Diff line number Diff line
@@ -3604,6 +3604,7 @@ func (n *runtimeJavascriptNakamaModule) multiUpdate(r *goja.Runtime) func(goja.F

				accountUpdates = append(accountUpdates, update)
			}
		}

		// Process storage update inputs.
		var storageWriteOps StorageOpWrites
@@ -3646,8 +3647,8 @@ func (n *runtimeJavascriptNakamaModule) multiUpdate(r *goja.Runtime) func(goja.F
					writeOp.Key = key
				}

					if userID, ok := dataMap["userId"]; ok {
						userIDStr, ok := userID.(string)
				if userIDIn, ok := dataMap["userId"]; ok {
					userIDStr, ok := userIDIn.(string)
					if !ok {
						panic(r.NewTypeError("expects 'userId' value to be a string"))
					}
@@ -3825,7 +3826,6 @@ func (n *runtimeJavascriptNakamaModule) multiUpdate(r *goja.Runtime) func(goja.F
			)
		}
		returnObj["walletUpdateAcks"] = updateWalletResults
		}

		return r.ToValue(returnObj)
	}