changed milestone to %Permission #review
added Priority::1 - High Product::Security Sprint::09/11 - Nuanced Numbat Squad::Blue scoped labels
added 1 commit
- 691dc667 - (feat): implement controller and further spec tests
added 1 commit
- 94b95611 - (feat): various changes to support with frontend work
added 1 commit
- d36fc658 - (feat): send notifications when subscription requests are made
unmarked as a Work In Progress
- Last updated by Mark Harding
49 // Construct URN on the fly 50 $subscriberGuid = $pages[0]; 51 $urn = "urn:subscription-request:" . implode('-', [ Session::getLoggedInUserGuid(), $subscriberGuid ]); 52 53 $request = $manager->get($urn); 54 55 if (!$request || $request->getPublisherGuid() != Session::getLoggedInUserGuid()) { 56 return Factory::response([ 57 'status' => 'error', 58 'message' => 'Not found', 59 ]); 60 } 61 62 try { 63 switch ($pages[1]) { 64 case "accept": - Developer
I'd say accept should be the put object because we're replacing the entity with the accepted request. Decline should probably be put under delete.
- Owner
I disagree with this, because the record isn't actually being deleted, its being modified. We maintain the subscription request so it can't be requested again.
- Last updated by Mark Harding
1 <?php 2 3 namespace Minds\Controllers\api\v2\subscriptions\incoming; 4 5 use Minds\Api\Factory; 6 use Minds\Core\Di\Di; 7 use Minds\Core\Session; 8 use Minds\Interfaces; 9 10 /** 11 * Incoming subscritions 12 */ 13 class all implements Interfaces\Api 14 { 15 public function get($pages) 16 { - Developer
This should just be on the REST endpoint for incoming
So we have
GET subscriptions/incoming returns all incoming subscription entities (with filtering in the query string)
GET subscriptions/incoming/:guid returns the single incoming subscription
- Owner
/all will return the full results
- Resolved by Mark Harding
- Resolved by Mark Harding
- Resolved by Mark Harding
94 94 /** 95 95 * Subscribe to a publisher 96 96 * @param User $publisher 97 * @param bool $force 97 98 * @return Subscription 98 99 */ 99 public function subscribe($publisher) 100 public function subscribe($publisher, $force = false) 100 101 { 101 102 $subscription = new Subscription(); 102 103 $subscription->setSubscriberGuid($this->subscriber->getGuid()) 103 104 ->setPublisherGuid($publisher->getGuid()); 104 105 106 if ($publisher->getMode() === 2 && !$force) { 107 throw new \Exception("Can not subscribe to closed channel, send a request instead"); - Developer
Could have a stronger typed exception here
26 private $entitiesBuilder; 27 28 public function __construct($repository = null, $notificationsDelegate = null, $subscriptionsDelegate = null, $entitiesBuilder = null) 29 { 30 $this->repository = $repository ?? new Repository(); 31 $this->notificationsDelegate = $notificationsDelegate ?? new NotificationsDelegate; 32 $this->subscriptionsDelegate = $subscriptionsDelegate ?? new SubscriptionsDelegate; 33 $this->entitiesBuilder = $entitiesBuilder ?? Di::_()->get('EntitiesBuilder'); 34 } 35 36 /** 37 * Return a list of incoming subscription requests 38 * @param array $opts 39 * @return Response 40 */ 41 public function getIncomingList($user_guid, array $opts = []) - Developer
Parameter type on $user_guid (which should be camel cased)?
Return type