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 242
    • Issues 242
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 31
    • Merge Requests 31
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • 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
  • !303

Open
Opened 1 day ago by Guy Thouret@gthouret
  • Report abuse
Report abuse

WIP: Propogate Properties when entities get updated

Check out, review, and merge locally

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

git fetch origin
git checkout -b chore/616-propogate-props origin/chore/616-propogate-props

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 chore/616-propogate-props

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 chore/616-propogate-props into master
The source branch is 4 commits behind the target branch
Open in Web IDE
  • Email patches
  • Plain diff
Pipeline #79226006 passed for 0032c435 on chore/616-propogate-props
          Requires 2 more approvals from Devs and Deployers.
          Brian Hatchet
          Brian Hatchet
          Mark Harding
          Mark Harding
          Martin Santangelo
          Martin Santangelo
          Marcelo Rivera
          Marcelo Rivera
          Emiliano Balbuena
          Emiliano Balbuena
          This is a Work in Progress
          You can merge this merge request manually using the
          • Discussion 9
          • Commits 11
          • Pipelines 7
          • Changes 25
          0/7 threads resolved
          • Loading...
          • Guy Thouret @gthouret added MR::Awaiting Review Priority::2 - Normal Squad::Blue scoped labels 1 day ago

            added MR::Awaiting Review Priority::2 - Normal Squad::Blue scoped labels

          • Guy Thouret @gthouret added 3 commits 1 day ago

            added 3 commits

            • 66727176 - (feat) Tidy interface of PropogateProperties class to a single public function - #616
            • 7cea5cdd - (feat) Refactor code that is propagating properties into the propagation framework - #616
            • 555d3a4f - (chore) Remove duplicate doc blocks for methods that already have their own doc blocks - #616

            Compare with previous version

          • Guy Thouret @gthouret added 12 commits 1 day ago

            added 12 commits

            • 555d3a4f...a437ec98 - 11 commits from branch master
            • d720d192 - Merge branch 'master' into chore/616-propogate-props

            Compare with previous version

          • Guy Thouret @gthouret added 3 commits 22 hours ago

            added 3 commits

            • 4ad8b92c - (chore) Linting new PropogateProperties classes - #616
            • 980d6ed4 - (fix) Typo changing all instances propogate -> propagate - #616
            • 12402bb2 - (fix) Regeressions in existing spec tests - #616

            Compare with previous version

          • Guy Thouret @gthouret added 1 commit 2 hours ago

            added 1 commit

            • 4d3e9456 - (chore) Add missing spec tests for new classes; Refactor usage to not use...

            Compare with previous version

          • Guy Thouret @gthouret added 1 commit 1 hour ago

            added 1 commit

            • 0032c435 - (chore) Lint recent changes - #616

            Compare with previous version

          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 39 minutes ago
            Core/Entities/PropagateProperties.php
            29 $this->save = $save ?? new Save();
            30 $this->entitiesBuilder = $entitiesBuilder ?? Di::_()->get('EntitiesBuilder');
            31 $this->registerPropagators();
            32 }
            33
            34 protected function registerPropagators(): void
            35 {
            36 /* Register PropertyPropagator classes here */
            37 $this->addPropagator(Core\Blogs\Delegates\PropagateProperties::class);
            38 $this->addPropagator(Core\Feeds\Delegates\PropagateProperties::class);
            39 $this->addPropagator(Core\Media\Delegates\PropagateProperties::class);
            40 $this->addPropagator(Core\Entities\Delegates\PropagateProperties::class);
            41 $this->addPropagator(Core\Permissions\Delegates\PropagateProperties::class);
            42 }
            43
            44 public function clearPropogators()
            • Mark Harding
              Mark Harding @markeharding · 39 minutes ago
              Owner

              void return type?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 35 minutes ago
            Core/Blogs/Delegates/PropagateProperties.php
            1 <?php
            2
            3 namespace Minds\Core\Blogs\Delegates;
            4
            5 use Minds\Core\Entities\Propagator\Properties;
            6 use Minds\Entities\Activity;
            7
            8 class PropagateProperties extends Properties
            9 {
            10 protected $actsOnSubtype = 'blog';
            11
            12 public function toActivity($from, Activity $to): Activity
            • Mark Harding
              Mark Harding @markeharding · 35 minutes ago
              Owner

              Can we have code docs on functions?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 35 minutes ago
            Core/Blogs/Delegates/PropagateProperties.php
            19 if ($this->valueHasChanged($blurb, $to->get('blurb'))) {
            20 $to->set('blurb', $blurb);
            21 }
            22
            23 if ($this->valueHasChanged($from->getUrl(), $to->getURL())) {
            24 $to->setURL($from->getUrl());
            25 }
            26
            27 if ($this->valueHasChanged($from->getIconUrl(), $to->get('thumbnail_src'))) {
            28 $to->set('thumbnail_src', $from->getIconUrl());
            29 }
            30
            31 return $to;
            32 }
            33
            34 public function fromActivity(Activity $from, $to)
            • Mark Harding
              Mark Harding @markeharding · 35 minutes ago
              Owner

              Return type?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 35 minutes ago
            Core/Entities/Delegates/PropagateProperties.php
            1 <?php
            2
            3 namespace Minds\Core\Entities\Delegates;
            4
            5 use Minds\Core\Entities\Propagator\Properties;
            6 use Minds\Entities\Activity;
            7
            8 class PropagateProperties extends Properties
            9 {
            10 public function toActivity($from, Activity $to): Activity
            • Mark Harding
              Mark Harding @markeharding · 35 minutes ago
              Owner

              code docs would be good

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 29 minutes ago
            Core/Blogs/Delegates/PropagateProperties.php
            19 if ($this->valueHasChanged($blurb, $to->get('blurb'))) {
            20 $to->set('blurb', $blurb);
            21 }
            22
            23 if ($this->valueHasChanged($from->getUrl(), $to->getURL())) {
            24 $to->setURL($from->getUrl());
            25 }
            26
            27 if ($this->valueHasChanged($from->getIconUrl(), $to->get('thumbnail_src'))) {
            28 $to->set('thumbnail_src', $from->getIconUrl());
            29 }
            30
            31 return $to;
            32 }
            33
            34 public function fromActivity(Activity $from, $to)
            • Mark Harding
              Mark Harding @markeharding · 29 minutes ago
              Owner

              Throw exception if called?

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 28 minutes ago
            Core/Entities/PropagateProperties.php
            19 /** @var Save */
            20 private $save;
            21 /** @var EntitiesBuilder */
            22 private $entitiesBuilder;
            23 /** @var bool */
            24 private $changed = false;
            25
            26 public function __construct(Call $db = null, Save $save = null, EntitiesBuilder $entitiesBuilder = null)
            27 {
            28 $this->db = $db ?? new Call('entities_by_time');
            29 $this->save = $save ?? new Save();
            30 $this->entitiesBuilder = $entitiesBuilder ?? Di::_()->get('EntitiesBuilder');
            31 $this->registerPropagators();
            32 }
            33
            34 protected function registerPropagators(): void
            • Mark Harding
              Mark Harding @markeharding · 28 minutes ago
              Owner

              code doc types

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding started a thread on the diff 28 minutes ago
            Core/Entities/Propagator/Properties.php
            1 <?php
            2
            3 namespace Minds\Core\Entities\Propagator;
            4
            5 use Minds\Entities\Activity;
            6
            7 abstract class Properties
            8 {
            9 protected $actsOnType = 'any';
            • Mark Harding
              Mark Harding @markeharding · 28 minutes ago
              Owner

              @var attributes

            • Please register or sign in to reply
          • Mark Harding
            Mark Harding @markeharding · 17 minutes ago
            Owner

            Updating an image failed to propagate with https://chore-616-propogate-props.minds.io/newsfeed/1013879218351640584. Also updating the activity did not update the original post.

            Edited by Mark Harding 14 minutes ago
          • Mark Harding
            Mark Harding @markeharding · 15 minutes ago
            Owner

            Blog also did not propagate at https://chore-616-propogate-props.minds.io/newsfeed/1013879964241498117

          • 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
          None
          Milestone
          None
          Assign milestone
          None
          Time tracking
          No estimate or time spent
          3
          Labels
          MR::Awaiting Review Priority::2 - Normal Squad::Blue
          Assign labels
          • View project labels
          Lock merge request
          Unlocked
          9
          9 participants
          user avatar
          Brian Hatchet
          user avatar
          Mark Harding
          user avatar
          Martin Santangelo
          user avatar
          Marcelo Rivera
          user avatar
          Emiliano Balbuena
          user avatar
          Rami Albatal
          user avatar
          Ben Hayward
          Reference: minds/engine!303