Problem/Motivation
Updating to version 3.0 has blocking feature, but user cannot see list of people they have blocked.
This was implemented in version 2, but lost upon the upgrade.
Steps to reproduce
- Go to private-message/ban
- Banned a user
- Reloading private-message/ban should show list of banned users.
Proposed resolution
Implement the // @todo in the banUnbanPage() function in the Controller
public function banUnbanPage() {
return [
'#prefix' => '<div id="private_message_ban_page">',
'#suffix' => '</div>',
'content' => [
// @todo list banned users.
[
'form' => $this->formBuilder->getForm(BanUserForm::class),
],
],
];
}
Version 2.0 method is as follows
public function blockUnblockPage() {
/** @var \Drupal\private_message\Entity\PrivateMessageBlock $block */
$block = $this->privateMessageService->getPrivateMessageBlockEntity();
$user_has_permission = $this->currentUser->hasPermission('edit private message block entities');
return [
'#prefix' => '<div id="private_message_block_page">',
'#suffix' => '</div>',
'content' => [
0 => !empty($block) && $user_has_permission ? $block->toLink('Edit blocked users', 'edit-form')
->toRenderable() : [],
1 => !empty($block) ? $block->block_users->view('default') : [],
2 => [
'form' => $this->formBuilder->getForm('Drupal\private_message\Form\BlockUserForm'),
],
],
'#attached' => [
'library' => [
'private_message/block_page',
],
],
];
}
Remaining tasks
- Implement adding a list of banned users for the current user
- Have ability for user to unbanned a banned user.
User interface changes
TBD
API changes
TBD
Data model changes
PrivateMessageBlock changed into PrivateMessageBan and was simplified in version 3.0. I think we can remove the "edit blocked users" link, and just list the banned users with a link to unban.