Don't show warning message on invitations page

Created on 11 January 2021, over 3 years ago
Updated 28 November 2023, 7 months ago

Problem/Motivation

When a user accesses the "Invitations" page (user/uid/invitations) the warning message that links to this same page appears.

This is redundant and could be eliminated.

Steps to reproduce

- Invite a user.
- Log in with this user, click on the link of the warning message to go to the invitations page.
- See the warning message on top.

Proposed resolution

The notifyAboutPendingInvitations should check wether the $event equals the url::fromRoute and, if so, avoid outputting the message.

  /**
   * Notify user about Pending invitations.
   *
   * @param \Symfony\Component\HttpKernel\Event\RequestEvent $event
   *   The GetResponseEvent to process.
   */
  public function notifyAboutPendingInvitations(RequestEvent $event) {
    if ($this->groupInvitationLoader->loadByUser()) {
      $replace = ['@url' => Url::fromRoute('view.my_invitations.page_1', ['user' => $this->currentUser->id()])->toString()];
      $message = $this->t('You have pending group invitations. <a href="@url">Visit your profile</a> to see them.', $replace);

      $this->messenger->addMessage($message, 'warning', FALSE);
    }
  }

Remaining tasks

TODO

User interface changes

TODO

API changes

None

Data model changes

None

✨ Feature request
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain idiaz.roncero Madrid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.69.0 2024