[COMPONENT][Conversation][ENTITY][ConversationMute] Rename Conversation{Block,Mute}

This commit is contained in:
Hugo Sales 2022-01-02 21:36:57 +00:00 committed by Diogo Peralta Cordeiro
parent ba0b0629b7
commit d5a6fa924b
No known key found for this signature in database
GPG Key ID: 18D2D35001FBFAB0
3 changed files with 10 additions and 10 deletions

View File

@ -29,11 +29,11 @@ namespace Component\Conversation\Controller;
use App\Core\DB\DB; use App\Core\DB\DB;
use App\Core\Form; use App\Core\Form;
use Component\Collection\Util\Controller\FeedController;
use function App\Core\I18n\_m; use function App\Core\I18n\_m;
use App\Util\Common; use App\Util\Common;
use App\Util\Exception\RedirectException; use App\Util\Exception\RedirectException;
use Component\Conversation\Entity\ConversationBlock; use Component\Collection\Util\Controller\FeedController;
use Component\Conversation\Entity\ConversationMute;
use Component\Feed\Feed; use Component\Feed\Feed;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
@ -66,7 +66,7 @@ class Conversation extends FeedController
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
DB::persist(ConversationBlock::create(['conversation_id' => $conversation_id, 'actor_id' => $user->getId()])); DB::persist(ConversationMute::create(['conversation_id' => $conversation_id, 'actor_id' => $user->getId()]));
DB::flush(); DB::flush();
throw new RedirectException(); throw new RedirectException();
} }

View File

@ -197,10 +197,10 @@ class Conversation extends Component
if ($activity->getObjectType() === 'note') { if ($activity->getObjectType() === 'note') {
$is_blocked = !empty(DB::dql( $is_blocked = !empty(DB::dql(
<<<'EOQ' <<<'EOQ'
select 1 SELECT 1
from note n FROM note AS n
join conversation_block cb with n.conversation_id = cb.conversation_id JOIN conversation_mute AS cm WITH n.conversation_id = cm.conversation_id
where n.id = :object_id WHERE n.id = :object_id
EOQ, EOQ,
['object_id' => $activity->getObjectId()], ['object_id' => $activity->getObjectId()],
)); ));

View File

@ -27,7 +27,7 @@ use App\Core\Entity;
use DateTimeInterface; use DateTimeInterface;
/** /**
* Entity class for ConversationsBlocks * Entity class for Conversations Mutes
* *
* @category DB * @category DB
* @package GNUsocial * @package GNUsocial
@ -36,7 +36,7 @@ use DateTimeInterface;
* @copyright 2022 Free Software Foundation, Inc http://www.fsf.org * @copyright 2022 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/ */
class ConversationBlock extends Entity class ConversationMute extends Entity
{ {
// {{{ Autocode // {{{ Autocode
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
@ -83,7 +83,7 @@ class ConversationBlock extends Entity
public static function schemaDef(): array public static function schemaDef(): array
{ {
return [ return [
'name' => 'conversation_block', 'name' => 'conversation_mute',
'fields' => [ 'fields' => [
'conversation_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Conversation.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'The conversation being blocked'], 'conversation_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Conversation.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'The conversation being blocked'],
'actor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'Who blocked the conversation'], 'actor_id' => ['type' => 'int', 'foreign key' => true, 'target' => 'Actor.id', 'multiplicity' => 'one to one', 'not null' => true, 'description' => 'Who blocked the conversation'],