WIP: Propogate Properties when entities get updated
0/7 threads resolved
added MR::Awaiting Review Priority::2 - Normal Squad::Blue scoped labels
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
added 12 commits
- 555d3a4f...a437ec98 - 11 commits from branch
master
- d720d192 - Merge branch 'master' into chore/616-propogate-props
- 555d3a4f...a437ec98 - 11 commits from branch
added 1 commit
- 4d3e9456 - (chore) Add missing spec tests for new classes; Refactor usage to not use...
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() - Owner
void return type?
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 - Owner
Can we have code docs on functions?
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) - Owner
Return type?
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 - Owner
code docs would be good
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) - Owner
Throw exception if called?
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 - Owner
code doc types
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'; - Owner
@var attributes
- 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 - Owner
Blog also did not propagate at https://chore-616-propogate-props.minds.io/newsfeed/1013879964241498117