Skip to content

Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
    • Help
    • Support
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
  • Sign in / Register
Minds Backend - Engine
Minds Backend - Engine
  • Project
    • Project
    • Details
    • Activity
    • Releases
    • Cycle Analytics
    • Insights
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
    • Locked Files
  • Issues 212
    • Issues 212
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 34
    • Merge Requests 34
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Security & Compliance
    • Security & Compliance
    • Dependency List
  • Packages
    • Packages
    • List
    • Container Registry
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Minds
  • Minds Backend - EngineMinds Backend - Engine
  • Merge Requests
  • !327

Open
Opened 1 day ago by Mark Harding@markeharding
  • Report abuse
Report abuse

Subscription Requests - #604

Edited 2 hours ago by Mark Harding

Check out, review, and merge locally

Step 1. Fetch and check out the branch for this merge request

git fetch origin
git checkout -b "epic/permissions-sub-reqs" "origin/epic/permissions-sub-reqs"

Step 2. Review the changes locally

Step 3. Merge the branch and fix any conflicts that come up

git fetch origin
git checkout "origin/master"
git merge --no-ff "epic/permissions-sub-reqs"

Step 4. Push the result of the merge to GitLab

git push origin "master"

Note that pushing to GitLab requires write access to this repository.

Tip: You can also checkout merge requests locally by following these guidelines.

Request to merge epic/permissions-sub-reqs into master
The source branch is 3 commits behind the target branch
Open in Web IDE
  • Email patches
  • Plain diff
Pipeline #82752920 passed for b43f9796 on epic/permissions-sub-reqs
          Requires 2 more approvals from Devs and Deployers.
          Ben Hayward
          Ben Hayward
          Rami Albatal
          Rami Albatal
          Marcelo Rivera
          Marcelo Rivera
          Brian Hatchet
          Brian Hatchet
          Emiliano Balbuena
          Emiliano Balbuena
          Ready to be merged automatically. Ask someone with write access to this repository to merge this request

          Mentions #604

          Deletes source branch

          • Discussion 11
          • Commits 7
          • Pipelines 7
          • Changes 19
          2/7 threads resolved
          • Loading...
          • Mark Harding @markeharding changed milestone to %Permission #review 1 day ago

            changed milestone to %Permission #review

          • Mark Harding @markeharding added Priority::1 - High Product::Security Sprint::09/11 - Nuanced Numbat Squad::Blue scoped labels 1 day ago

            added Priority::1 - High Product::Security Sprint::09/11 - Nuanced Numbat Squad::Blue scoped labels

          • Mark Harding @markeharding added 1 commit 22 hours ago

            added 1 commit

            • a0b6deb6 - (feat): spec tests and delegate for manager

            Compare with previous version

          • Mark Harding @markeharding added 1 commit 9 hours ago

            added 1 commit

            • 691dc667 - (feat): implement controller and further spec tests

            Compare with previous version

          • Mark Harding @markeharding added 1 commit 5 hours ago

            added 1 commit

            • 94b95611 - (feat): various changes to support with frontend work

            Compare with previous version

          • Mark Harding @markeharding added 1 commit 5 hours ago

            added 1 commit

            • 51f551dd - (fix): failing tests

            Compare with previous version

          • Mark Harding @markeharding added 1 commit 3 hours ago

            added 1 commit

            • d36fc658 - (feat): send notifications when subscription requests are made

            Compare with previous version

          • Mark Harding @markeharding added 1 commit 2 hours ago

            added 1 commit

            • b43f9796 - (fix): incorrect variable in notifications

            Compare with previous version

          • Mark Harding @markeharding unmarked as a Work In Progress 2 hours ago

            unmarked as a Work In Progress

          • Brian Hatchet
            Brian Hatchet :speech_balloon: @brianhatchet started a thread on the diff 20 minutes ago
            Last updated by Mark Harding 18 minutes ago
            Controllers/api/v2/subscriptions/incoming.php
            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":
            • Brian Hatchet
              Brian Hatchet :speech_balloon: @brianhatchet · 20 minutes ago
              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.

            • Mark Harding
              Mark Harding @markeharding · 18 minutes ago
              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.

            • Please register or sign in to reply
          • Brian Hatchet
            Brian Hatchet :speech_balloon: @brianhatchet started a thread on the diff 20 minutes ago
            Last updated by Mark Harding 17 minutes ago
            Controllers/api/v2/subscriptions/incoming/all.php
            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 {
            • Brian Hatchet
              Brian Hatchet :speech_balloon: @brianhatchet · 20 minutes ago
              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

            • Mark Harding
              Mark Harding @markeharding · 17 minutes ago
              Owner

              /all will return the full results

            • Please register or sign in to reply
          • Brian Hatchet
            Brian Hatchet :speech_balloon: @brianhatchet started a thread on the diff 20 minutes ago
            Last updated by Mark Harding 17 minutes ago
            Controllers/api/v2/subscriptions/outgoing/all.php
            1 <?php
            2
            3 namespace Minds\Controllers\api\v2\subscriptions\outgoing;
            4
            5 use Minds\Api\Factory;
            6 use Minds\Core\Di\Di;
            7 use Minds\Core\Session;
            8 use Minds\Interfaces;
            9
            10 /**
            11 * Outgoing subscritions
            12 */
            13 class all implements Interfaces\Api
            14 {
            15 public function get($pages)
            16 {
            • Brian Hatchet
              Brian Hatchet :speech_balloon: @brianhatchet · 20 minutes ago
              Developer

              Same review as incoming, just with more functionality

            • Mark Harding
              Mark Harding @markeharding · 17 minutes ago
              Owner

              this is todo, not sure if we will be supporting this endpoint anytime soon

            • Please register or sign in to reply
          • Brian Hatchet
            Brian Hatchet :speech_balloon: @brianhatchet started a thread on the diff 20 minutes ago
            Resolved by Mark Harding 17 minutes ago
          • Brian Hatchet
            Brian Hatchet :speech_balloon: @brianhatchet started a thread on the diff 20 minutes ago
            Resolved by Mark Harding 16 minutes ago
          • Brian Hatchet
            Brian Hatchet :speech_balloon: @brianhatchet started a thread on the diff 20 minutes ago
            Core/Subscriptions/Manager.php
            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");
            • Brian Hatchet
              Brian Hatchet :speech_balloon: @brianhatchet · 20 minutes ago
              Developer

              Could have a stronger typed exception here

            • Please register or sign in to reply
          • Brian Hatchet
            Brian Hatchet :speech_balloon: @brianhatchet started a thread on the diff 20 minutes ago
            Core/Subscriptions/Requests/Manager.php
            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 = [])
            • Brian Hatchet
              Brian Hatchet :speech_balloon: @brianhatchet · 20 minutes ago
              Developer

              Parameter type on $user_guid (which should be camel cased)?

              Return type

            • Please register or sign in to reply
          • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
          Please register or sign in to reply
          0 Assignees
          None
          Assign to
          Permission #review
          Milestone
          Permission #review
          Assign milestone
          None
          Time tracking
          No estimate or time spent
          4
          Labels
          Priority::1 - High Product::Security Sprint::09/11 - Nuanced Numbat Squad::Blue
          Assign labels
          • View project labels
          Lock merge request
          Unlocked
          7
          7 participants
          user avatar
          Ben Hayward
          user avatar
          Rami Albatal
          user avatar
          Marcelo Rivera
          user avatar
          Brian Hatchet
          user avatar
          Emiliano Balbuena
          user avatar
          Martin Santangelo
          user avatar
          Mark Harding
          Reference: minds/engine!327