Commit 4572a649 authored by Guy Thouret's avatar Guy Thouret

(fix) Media post was updating the wrong activity field - #616

1 merge request!303Propagate Properties when entities get updated
Pipeline #82365278 pending with stages
......@@ -22,8 +22,8 @@ class PropagateProperties extends Properties
*/
public function toActivity($from, Activity $to): Activity
{
if ($this->valueHasChanged($from->title, $to->get('title'))) {
$to->set('title', $from->title);
if ($this->valueHasChanged($from->title, $to->getMessage())) {
$to->setMessage($from->title);
}
$fromData = $from->getActivityParameters();
......@@ -43,8 +43,8 @@ class PropagateProperties extends Properties
*/
public function fromActivity(Activity $from, $to)
{
if ($this->valueHasChanged($from->get('title'), $to->title)) {
$to->title = $from->get('title');
if ($this->valueHasChanged($from->getMessage(), $to->title)) {
$to->title = $from->getMessage();
}
return $to;
......
......@@ -29,8 +29,8 @@ class PropagatePropertiesSpec extends ObjectBehavior
public function it_should_propagate_changes_to_activity()
{
$this->entity->get('title')->shouldBeCalled()->willReturn('new title');
$this->activity->get('title')->shouldBeCalled()->willReturn('old title');
$this->activity->set('title', 'new title')->shouldBeCalled();
$this->activity->getMessage()->shouldBeCalled()->willReturn('old title');
$this->activity->setMessage('new title')->shouldBeCalled();
$activityParameters = [
'batch',
......@@ -49,7 +49,7 @@ class PropagatePropertiesSpec extends ObjectBehavior
public function it_should_propogate_properties_from_activity()
{
$this->activity->get('title')->shouldBeCalled()->willReturn('new title');
$this->activity->getMessage()->shouldBeCalled()->willReturn('new title');
$this->entity->get('title')->shouldbeCalled()->willReturn('old title');
$this->entity->set('title', 'new title')->shouldBeCalled();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment