Internal: Social: Allow save parent post + fix wall listing first posts without parent

pull/5099/head
Angel Fernando Quiroz Campos 2 years ago
parent 782b7ed354
commit e655a298a6
  1. 1
      assets/vue/components/social/SocialWallPostList.vue
  2. 3
      src/CoreBundle/Entity/SocialPost.php

@ -49,6 +49,7 @@ function listPosts() {
params: {
socialwall_wallOwner: user.value['id'],
'order[sendDate]': 'desc',
'exists[parent]': false,
}
})
.then(response => {

@ -6,6 +6,7 @@ declare(strict_types=1);
namespace Chamilo\CoreBundle\Entity;
use ApiPlatform\Doctrine\Orm\Filter\ExistsFilter;
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
use ApiPlatform\Metadata\ApiFilter;
@ -67,6 +68,7 @@ use Symfony\Component\Validator\Constraints as Assert;
security: "is_granted('ROLE_USER')"
)]
#[ApiFilter(filterClass: SearchFilter::class, properties: ['parent' => 'exact'])]
#[ApiFilter(filterClass: ExistsFilter::class, properties: ['parent'])]
#[ApiFilter(filterClass: OrderFilter::class, properties: ['sendDate'])]
class SocialPost
{
@ -132,6 +134,7 @@ class SocialPost
#[ORM\OneToMany(targetEntity: self::class, mappedBy: 'parent')]
protected Collection $children;
#[Groups(['social_post:write'])]
#[ORM\ManyToOne(targetEntity: self::class, inversedBy: 'children')]
#[ORM\JoinColumn(name: 'parent_id', referencedColumnName: 'id', onDelete: 'CASCADE')]
protected ?SocialPost $parent = null;

Loading…
Cancel
Save