Skip to content

Commit 272a28b

Browse files
Show message in spam folder to initiator. Show messages in spam if moved to spam on block word.
1 parent 51bf68a commit 272a28b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/Pagerfanta/AbstractConversationsAdapter.php

+5-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ public function getNbResults(): int
5757
*/
5858
public function getSlice(int $offset, int $length): iterable
5959
{
60-
$sql = 'SELECT * FROM (' . $this->getConversationsQuery() . ') m';
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';
6164
$sql .= ' ORDER BY `m`.`created` DESC LIMIT ' . $length . ' OFFSET ' . $offset;
6265

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

122125
protected function getNotSpamCondition(): string
123126
{
124-
return 'InFolder <> \'' . InFolderType::SPAM . '\'';
127+
return '(m.initiator_id <> :memberId AND InFolder <> \'' . InFolderType::SPAM . '\')';
125128
}
126129

127130
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 . '%\' AND InFolder = \'' . InFolderType::SPAM . '\'';
45+
return '(SpamInfo LIKE \'%' . SpamInfoType::MEMBER_SAYS_SPAM . '%\'SpamInfo LIKE \'%' . SpamInfoType::SPAM_BLOCKED_WORD . '%\') OR AND InFolder = \'' . InFolderType::SPAM . '\'';
4646
}
4747
}

0 commit comments

Comments
 (0)