mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Add DDP._CurrentPublicationInvocation
This will make it possible to determine if code that is running has been called from a publish function.
This commit is contained in:
@@ -6,3 +6,4 @@ LivedataTest.SUPPORTED_DDP_VERSIONS = DDPCommon.SUPPORTED_DDP_VERSIONS;
|
||||
// it to get the current user. Meteor.setTimeout and friends clear
|
||||
// it. We can probably find a better way to factor this.
|
||||
DDP._CurrentInvocation = new Meteor.EnvironmentVariable;
|
||||
DDP._CurrentPublicationInvocation = new Meteor.EnvironmentVariable;
|
||||
|
||||
@@ -1041,12 +1041,16 @@ _.extend(Subscription.prototype, {
|
||||
|
||||
var self = this;
|
||||
try {
|
||||
var res = maybeAuditArgumentChecks(
|
||||
self._handler, self, EJSON.clone(self._params),
|
||||
// It's OK that this would look weird for universal subscriptions,
|
||||
// because they have no arguments so there can never be an
|
||||
// audit-argument-checks failure.
|
||||
"publisher '" + self._name + "'");
|
||||
var res = DDP._CurrentPublicationInvocation.withValue(
|
||||
self,
|
||||
() => maybeAuditArgumentChecks(
|
||||
self._handler, self, EJSON.clone(self._params),
|
||||
// It's OK that this would look weird for universal subscriptions,
|
||||
// because they have no arguments so there can never be an
|
||||
// audit-argument-checks failure.
|
||||
"publisher '" + self._name + "'"
|
||||
)
|
||||
);
|
||||
} catch (e) {
|
||||
self.error(e);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user