Skip to content
Snippets Groups Projects
Commit bdf290ad authored by Kevin Jahns's avatar Kevin Jahns
Browse files

added safety to setUserId (when called twice)

parent 98d87cb2
No related branches found
No related tags found
No related merge requests found
...@@ -144,3 +144,4 @@ Yjs is licensed under the [MIT License](./LICENSE.txt). ...@@ -144,3 +144,4 @@ Yjs is licensed under the [MIT License](./LICENSE.txt).
[ShareJs]: https://github.com/share/ShareJS [ShareJs]: https://github.com/share/ShareJS
[OpenCoweb]: https://github.com/opencoweb/coweb/wiki [OpenCoweb]: https://github.com/opencoweb/coweb/wiki
Subproject commit 8ba1e4ce27a75bb025a5478723ea57f7f437ccf0 Subproject commit ab6a193ec6ec799bdb77fa23eeec1f05d5b910d6
...@@ -63,8 +63,12 @@ module.exports = function (Y/* :any */) { ...@@ -63,8 +63,12 @@ module.exports = function (Y/* :any */) {
return this.y.db.stopGarbageCollector() return this.y.db.stopGarbageCollector()
} }
setUserId (userId) { setUserId (userId) {
this.userId = userId if (this.userId == null) {
return this.y.db.setUserId(userId) this.userId = userId
return this.y.db.setUserId(userId)
} else {
return null
}
} }
onUserEvent (f) { onUserEvent (f) {
this.userEventListeners.push(f) this.userEventListeners.push(f)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment