Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15404732
D16757.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D16757.diff
View Options
diff --git a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php
--- a/src/applications/phortune/worker/PhortuneSubscriptionWorker.php
+++ b/src/applications/phortune/worker/PhortuneSubscriptionWorker.php
@@ -36,17 +36,32 @@
->setSubscription($subscription);
// TODO: This isn't really ideal. It would be better to use an application
- // actor than the original author of the subscription. In particular, if
- // someone initiates a subscription, adds some other account managers, and
- // later leaves the company, they'll continue "acting" here indefinitely.
+ // actor than a fairly arbitrary account member.
+
// However, for now, some of the stuff later in the pipeline requires a
// valid actor with a real PHID. The subscription should eventually be
// able to create these invoices "as" the application it is acting on
// behalf of.
- $actor = id(new PhabricatorPeopleQuery())
+
+ $members = id(new PhabricatorPeopleQuery())
->setViewer($viewer)
- ->withPHIDs(array($subscription->getAuthorPHID()))
- ->executeOne();
+ ->withPHIDs($account->getMemberPHIDs())
+ ->execute();
+ $actor = null;
+ foreach ($members as $member) {
+
+ // Don't act as a disabled user. If all of the users on the account are
+ // disabled this means we won't charge the subscription, but that's
+ // probably correct since it means no one can cancel or pay it anyway.
+ if ($member->getIsDisabled()) {
+ continue;
+ }
+
+ // For now, just pick the first valid user we encounter as the actor.
+ $actor = $member;
+ break;
+ }
+
if (!$actor) {
throw new Exception(pht('Failed to load actor to bill subscription!'));
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Mar 19, 8:47 AM (2 w, 12 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7699274
Default Alt Text
D16757.diff (1 KB)
Attached To
Mode
D16757: Fix a Phortune bug where an invalid viewer could sometimes be selected for billing a subscription
Attached
Detach File
Event Timeline
Log In to Comment