Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.0] Fixes bug showing newsletter PMs to the author #8466

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Sources/PersonalMessage/Conversation.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,10 @@ public function __construct(int $pm)
}

// If the current user deleted this PM, skip it.
if (($from_me && !empty($row['deleted_by_sender'])) || ($to_me && !empty($row['deleted']))) {
$visible_in_inbox = $to_me && empty($row['deleted']);
$visible_in_sent = $from_me && empty($row['deleted_by_sender']);

if (!$visible_in_inbox && !$visible_in_sent) {
continue;
}

Expand Down
7 changes: 0 additions & 7 deletions Sources/PersonalMessage/Folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,6 @@ protected function showConversation(): array

$conversation = new Conversation($id);

// Empty conversation?
if (empty($conversation->pms) || empty($conversation->latest)) {
PM::$getter = [];

return [];
}

Utils::$context['current_pm'] = $conversation->latest;

// The templates need some profile data for the senders.
Expand Down
12 changes: 6 additions & 6 deletions Sources/PersonalMessage/PM.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,12 +433,12 @@ public function canAccess(string $folders = 'both'): bool

if ($this->member_from === User::$me->id) {
$valid_for['sent'] = !$this->deleted_by_sender;
} else {
foreach ($this->received as $received) {
if ($received->member === User::$me->id) {
$valid_for['inbox'] = !$received->deleted;
break;
}
}

foreach ($this->received as $received) {
if ($received->member === User::$me->id) {
$valid_for['inbox'] = !$received->deleted;
break;
}
}

Expand Down