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.

CommentFileSizeAuthor
#3 ban_user_screenshot.png35.97 KBsagesolutions
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sagesolutions created an issue. See original summary.

sagesolutions’s picture

Status: Active » Needs review
FileSize
35.97 KB

Added list of banned users on the ban/unban page.

Please review!

Banned User list