Provide a block with DA announcements

Created on 20 July 2023, over 1 year ago
Updated 10 January 2024, 11 months ago

Problem/Motivation

announcements_feed.module was recently added in core, with the goal of providing updates about the Drupal project and Drupal Association announcements into Drupal sites.

This is the kind of content that totally fits into a dashboard for webmasters/site admins, so there should be a block providing that feed information which can be added to a dashboard.

Proposed resolution

Provide a block that shows the announcements.

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

None.

Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

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

Comments & Activities

  • Issue created by @penyaskito
  • Assigned to friera
  • 🇪🇸Spain fjgarlin

    This might be a normal "feature request" for "core" at the moment. Making available a block with this information shouldn't be too complex.

    See also the related issues here 📌 Mark Announcements Feed as stable Fixed , as I believe there is overlap with this one.

  • 🇪🇸Spain friera

    To do not include external dependencies in the dashboard module. I have created a submodule called dashboard_blocks that could be used to add new needed blocks to be included in dashboard module.

    Attached I provide the patch, it includes a functional test to check that the inclusion in the dashboard is working as expected.

  • Status changed to Needs work over 1 year ago
  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺
    1. +++ b/modules/dashboard_blocks/src/Plugin/Block/DrupalAnnouncementsBlock.php
      @@ -0,0 +1,82 @@
      +  public function __construct(array $configuration, $plugin_id, $plugin_definition, private AnnounceFetcher $announceFetcher, private string $feedLink) {
      

      Nice use of the constructor properties promotion! Those should be protected instead of private though.

    2. +++ b/modules/dashboard_blocks/tests/src/Functional/DashboardBlocksSelectionTest.php
      @@ -0,0 +1,85 @@
      +    $this->getSession()
      +      ->getPage()
      +      ->find('xpath', '//*[@id="layout-builder"]/div[@class="layout-builder__add-section"]/a')
      +      ->click();
      

      Can we use

      $page->pressButton('Add section');

      here?

    3. +++ b/modules/dashboard_blocks/tests/src/Functional/DashboardBlocksSelectionTest.php
      @@ -0,0 +1,85 @@
      +    $this->assertSession()->pageTextContains('Drupal Announcements Block');
      

      If we add a Javascript test we could also assert some content inside the block.

    Thanks for working on this!

  • 🇪🇸Spain friera

    Thank you, for the review. I provide a new patch.

  • Status changed to Needs review about 1 year ago
  • 🇪🇸Spain rvilar Montcada i Reixac, Catalonia
  • Status changed to Needs work about 1 year ago
  • 🇪🇸Spain fjgarlin

    If we can change from a patch to a Merge request it will help with the code review. For now, I see a lot of duplication in the method public function build(), which means that maybe we could change something upstream so it can be reused in both the announcements module and the dashboard module.

    Actually, the block creation and the tests look good, so maybe it should all go against the "announcements" module. You can create a fork and MR with the changes here 📌 Convert announcements feed from toolbar to dashboard Postponed as making the announcements content available as a block is a really good idea.

  • 🇪🇸Spain fjgarlin

    Part of this code here https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/annou... could be made a bit more generic so it's reusable.

    If you have time to work on it that'd be great otherwise I could try to give it a go next week.

  • 🇪🇸Spain plopesc Valladolid

    Thanks for the suggestion @fjgarlin!

    Created MR to test the block approach in 📌 Convert announcements feed from toolbar to dashboard Postponed

  • Status changed to RTBC about 1 year ago
  • 🇪🇸Spain fjgarlin

    I'm not sure how the issues for this sandbox are handled, but for me, given that there is a core issue already which does exactly that, would mean that this issue no longer "needs work". I'm reviewing and testing the core one.

    I'm marking this as RTBC because I no longer think there is anything else to do "here".

  • Issue was unassigned.
  • 🇪🇸Spain plopesc Valladolid

    Thank you for your review @fjgarlin!

    Adding reference to the core issue to keep track of it.

  • Status changed to Fixed about 1 year ago
  • 🇪🇸Spain plopesc Valladolid

    Marking as fixed once 📌 Convert announcements feed from toolbar to dashboard Postponed has been committed.

    Thank you all for your help here!

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Status changed to Fixed 11 months ago
  • 🇪🇸Spain plopesc Valladolid
Production build 0.71.5 2024