From d5a6fa924b7b19ef44a2c9f339aa7038b0b4439e Mon Sep 17 00:00:00 2001 From: Hugo Sales Date: Sun, 2 Jan 2022 21:36:57 +0000 Subject: [PATCH] [COMPONENT][Conversation][ENTITY][ConversationMute] Rename Conversation{Block,Mute} --- components/Conversation/Controller/Conversation.php | 6 +++--- components/Conversation/Conversation.php | 8 ++++---- .../{ConversationBlock.php => ConversationMute.php} | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) rename components/Conversation/Entity/{ConversationBlock.php => ConversationMute.php} (95%) diff --git a/components/Conversation/Controller/Conversation.php b/components/Conversation/Controller/Conversation.php index 51a2679041..edb40b07f8 100644 --- a/components/Conversation/Controller/Conversation.php +++ b/components/Conversation/Controller/Conversation.php @@ -29,11 +29,11 @@ namespace Component\Conversation\Controller; use App\Core\DB\DB; use App\Core\Form; -use Component\Collection\Util\Controller\FeedController; use function App\Core\I18n\_m; use App\Util\Common; 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 Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\HttpFoundation\Request; @@ -66,7 +66,7 @@ class Conversation extends FeedController $form->handleRequest($request); 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(); throw new RedirectException(); } diff --git a/components/Conversation/Conversation.php b/components/Conversation/Conversation.php index 3a697b8481..0fdb0f41d4 100644 --- a/components/Conversation/Conversation.php +++ b/components/Conversation/Conversation.php @@ -197,10 +197,10 @@ class Conversation extends Component if ($activity->getObjectType() === 'note') { $is_blocked = !empty(DB::dql( <<<'EOQ' - select 1 - from note n - join conversation_block cb with n.conversation_id = cb.conversation_id - where n.id = :object_id + SELECT 1 + FROM note AS n + JOIN conversation_mute AS cm WITH n.conversation_id = cm.conversation_id + WHERE n.id = :object_id EOQ, ['object_id' => $activity->getObjectId()], )); diff --git a/components/Conversation/Entity/ConversationBlock.php b/components/Conversation/Entity/ConversationMute.php similarity index 95% rename from components/Conversation/Entity/ConversationBlock.php rename to components/Conversation/Entity/ConversationMute.php index d83828fb8f..3bc7932339 100644 --- a/components/Conversation/Entity/ConversationBlock.php +++ b/components/Conversation/Entity/ConversationMute.php @@ -27,7 +27,7 @@ use App\Core\Entity; use DateTimeInterface; /** - * Entity class for ConversationsBlocks + * Entity class for Conversations Mutes * * @category DB * @package GNUsocial @@ -36,7 +36,7 @@ use DateTimeInterface; * @copyright 2022 Free Software Foundation, Inc http://www.fsf.org * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later */ -class ConversationBlock extends Entity +class ConversationMute extends Entity { // {{{ Autocode // @codeCoverageIgnoreStart @@ -83,7 +83,7 @@ class ConversationBlock extends Entity public static function schemaDef(): array { return [ - 'name' => 'conversation_block', + 'name' => 'conversation_mute', 'fields' => [ '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'],