Skip to content

Commit

Permalink
Merge pull request #315 from nachocodoner/fix-publish-wrapper
Browse files Browse the repository at this point in the history
Fix publish wrapper on meteor 3.0
  • Loading branch information
StorytellerCZ authored Sep 3, 2024
2 parents 283002b + 5acc8a2 commit c9715e0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ CollectionHooks.getUserId = function getUserId () {

const _publish = Meteor.publish
Meteor.publish = function (name, handler, options) {
return _publish.call(this, name, function (...args) {
return publishUserId.withValue(this && this.userId, () => _publish.call(this, name, function (...args) {
// This function is called repeatedly in publications
return publishUserId.withValue(this && this.userId, () => handler.apply(this, args))
}, options)
return handler.apply(this, args)
}, options))
}

// Make the above available for packages with hooks that want to determine
Expand Down

0 comments on commit c9715e0

Please sign in to comment.