Skip to content

Commit 103c47a

Browse files
Fix messages not shown to sender if receiver moved to spam.
1 parent 272a28b commit 103c47a

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/Pagerfanta/AbstractConversationsAdapter.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ public function getNbResults(): int
5757
*/
5858
public function getSlice(int $offset, int $length): iterable
5959
{
60-
$sql = 'SELECT *, i.id, r.id, s.id FROM (' . $this->getConversationsQuery() . ') m';
61-
$sql .= ' JOIN members i ON m.initiator_id = i.id';
62-
$sql .= ' JOIN members r ON m.IdReceiver = r.id';
63-
$sql .= ' JOIN members s ON m.IdSender = s.id';
60+
$sql = 'SELECT * FROM (' . $this->getConversationsQuery() . ') m';
6461
$sql .= ' ORDER BY `m`.`created` DESC LIMIT ' . $length . ' OFFSET ' . $offset;
6562

6663
$query = $this->entityManager->createNativeQuery($sql, new MessageResultSetMapping())
@@ -124,7 +121,7 @@ protected function getInitiatorCondition(): string
124121

125122
protected function getNotSpamCondition(): string
126123
{
127-
return '(m.initiator_id <> :memberId AND InFolder <> \'' . InFolderType::SPAM . '\')';
124+
return '(m.initiator_id = :memberId or InFolder <> \'' . InFolderType::SPAM . '\')';
128125
}
129126

130127
abstract protected function getConversationsQuery(): string;

src/Pagerfanta/SpamAdapter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ protected function getConversationsQuery(): string
4242

4343
private function getSpamCondition(): string
4444
{
45-
return '(SpamInfo LIKE \'%' . SpamInfoType::MEMBER_SAYS_SPAM . '%\'SpamInfo LIKE \'%' . SpamInfoType::SPAM_BLOCKED_WORD . '%\') OR AND InFolder = \'' . InFolderType::SPAM . '\'';
45+
return '(SpamInfo LIKE \'%' . SpamInfoType::MEMBER_SAYS_SPAM . '%\' OR SpamInfo LIKE \'%' . SpamInfoType::SPAM_BLOCKED_WORD . '%\') AND InFolder = \'' . InFolderType::SPAM . '\'';
4646
}
4747
}

templates/admin/checker/messages.html.twig

+5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
<div class="float-left">
3838
{{ pagerfanta( reported, 'rox_default') }}
3939
</div>
40+
<div class="row">
41+
<div class="col-12 text-right">
42+
<button type="submit" class="btn btn-primary">{{ 'button.update' | trans }}</button>
43+
</div>
44+
</div>
4045
{% endif %}
4146
<table class="table table-striped table-hover">
4247

0 commit comments

Comments
 (0)