[userclass] ghosts should still be able to read PMs

This commit is contained in:
Shish 2023-12-21 21:09:49 +00:00
parent a491d70b0e
commit ad181377c8
3 changed files with 7 additions and 3 deletions

View file

@ -88,6 +88,7 @@ unset($_all_false);
// Ghost users can't do anything
new UserClass("ghost", "base", [
Permissions::READ_PM => true,
]);
// Anonymous users can't do anything by default, but

View file

@ -212,7 +212,7 @@ class PrivMsg extends Extension
if (!is_null($pms)) {
$this->theme->display_pms($page, $pms);
}
if ($user->id != $duser->id) {
if ($user->can(Permissions::SEND_PM) && $user->id != $duser->id) {
$this->theme->display_composer($page, $user, $duser);
}
}
@ -235,7 +235,11 @@ class PrivMsg extends Extension
$database->execute("UPDATE private_message SET is_read=true WHERE id = :id", ["id" => $pm_id]);
$cache->delete("pm-count-{$user->id}");
}
$this->theme->display_message($page, $from_user, $user, PM::from_row($pm));
$pmo = PM::from_row($pm);
$this->theme->display_message($page, $from_user, $user, $pmo);
if($user->can(Permissions::SEND_PM)) {
$this->theme->display_composer($page, $user, $from_user, "Re: ".$pmo->subject);
}
} else {
$this->theme->display_permission_denied();
}

View file

@ -81,7 +81,6 @@ EOD;
public function display_message(Page $page, User $from, User $to, PM $pm)
{
$this->display_composer($page, $to, $from, "Re: ".$pm->subject);
$page->set_title("Private Message");
$page->set_heading(html_escape($pm->subject));
$page->add_block(new NavBlock());