[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
Signed by: diogo
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\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();
}

View File

@ -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()],
));

View File

@ -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'],