- Issue created by @pirtpal_singh
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
Thank you for applying!
Please read Review process for security advisory coverage: What to expect โ for more details and Security advisory coverage application checklist โ to understand what reviewers look for. Tips for ensuring a smooth review โ gives some hints for a smoother review.
The important notes are the following.
- If you have not done it yet, enable GitLab CI for the project, and fix what reported from the phpcs job. This help to fix most of what reviewers would report.
- For the time this application is open, only your commits are allowed. No other people, including other maintainers/co-maintainers can make commits.
- The purpose of this application is giving you a new drupal.org role that allows you to opt projects into security advisory coverage, either projects you already created, or projects you will create. The project status won't be changed by this application.
- Nobody else will get the permission to opt projects into security advisory policy. If there are other maintainers/co-maintainers who will to get that permission, they need to apply with a different module.
- We only accept an application per user. If you change your mind about the project to use for this application, or it is necessary to use a different project for the application, please update the issue summary with the link to the correct project and the issue title with the project name and the branch to review.
To the reviewers
Please read How to review security advisory coverage applications โ , Application workflow โ , What to cover in an application review โ , and Tools to use for reviews โ .
The important notes are the following.
- It is preferable to wait for a Code Review Administrator before commenting on newly created applications. Code Review Administrators will do some preliminary checks that are necessary before any change on the project files is suggested.
- Reviewers should show the output of a CLI tool โ only once per application. The configuration used for these tools needs to be the same configuration used by GitLab CI, stored in the GitLab Templates repository.
- It may be best to have the applicant fix things before further review.
For new reviewers, I would also suggest to first read In which way the issue queue for coverage applications is different from other project queues โ .
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
I do not have time for a full review.
If a controller class does not use any method/property from the parent class, it does not need to use
ControllerBase
as parent class. Controllers do not need to have a parent class; as long as they implement\Drupal\Core\DependencyInjection\ContainerInjectionInterface
, they are fine. - ๐ฎ๐ณIndia vishal.kadam Mumbai
1. FILE: firebase_ui.info.yml
package: 'Custom'
This line is used by custom modules created for specific sites. It is not a package name used for projects hosted on drupal.org.
version: 1.0.0
Remove "version" from the info file, it will be added by drupal.org packaging automatically.
2. FILE: firebase_ui.module
/** * @file * Firebase UI module. */
The usual description for a .module file is โHook implementations for the [module name] moduleโ, where [module name] is the module name given in the .info.yml file.
- ๐ฎ๐ณIndia pirtpal_singh Ludhana
Thank you for the feedback.
โ Iโve updated the module with the following changes based on your recommendations:
- Removed
version
fromfirebase_ui.info.yml
(handled by Drupal.org packaging) - Changed
package
from'Custom'
to'Notifications'
- Updated the
.module
file docblock to: โHook implementations for the Firebase UI module.โ - Removed unnecessary
ControllerBase
inheritance where not needed, keeping onlyContainerInjectionInterface
Let me know if anything else is needed.
- Removed
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
src/Controller/FirebaseUiController.php
Since
ControllerBase
is the parent class, the properties that class define do not need to be re-declared. Furthermore, the parent class has methods likeControllerBase::entityTypeManager()
. (Unfortunately, the parent class does not have a constructor, which would have allowed to initialize that property without accessing it directly.)src/Controller/ServiceWorkerController.php
$current_user = \Drupal::currentUser();
Dependencies need to be injected using the dependency container. A controller needs to implement
\Drupal\Core\DependencyInjection\ContainerInjectionInterface
when it has dependencies.src/Entity/FirebaseNotification.php
/** * Defines the Firebase Notification entity. * * @ContentEntityType( * id = "firebase_notification", * label = @Translation("Firebase Notification"), * base_table = "firebase_notification", * entity_keys = { * "id" = "id", * "uuid" = "uuid", * }, * handlers = { * "list_builder" = "Drupal\Core\Entity\EntityListBuilder", * "form" = { * "default" = "Drupal\Core\Entity\ContentEntityForm" * } * }, * admin_permission = "administer site configuration", * ) */
Since the module is not defined compatible with Drupal 9, it can use attributes to define plugins, not annotations. (It should also define itself compatible with Drupal 10.3, not Drupal 10, since before that release attribute classes are not implemented.)
src/Form/FirebaseUISettingsForm.php
$form['apiKey'] = [ '#type' => 'textfield', '#title' => $this->t('API Key'), '#default_value' => $config->get('apiKey'), '#required' => TRUE, '#description' => $this->t('Enter your Firebase project\'s API key. You can find this in your Firebase Console under Project Settings. <a href="https://firebase.google.com/static/codelabs/firebase-get-to-know-web/img/f2c0f5838d0e8202_856.png" target="_blank">View instructions</a>.'), ];
URLs are added to translatable strings using placeholders. Drupal core itself does that for drupal.org URLs. One of the reasons for that is not giving to translators something they do not need to translate.
src/Plugin/QueueWorker/FirebaseNotificationQueueWorker.php
Any dependency must be injected using the dependency injection container, except in the case the dependency is used only from static methods.
- ๐ฎ๐ณIndia pirtpal_singh Ludhana
Thank You for Your Feedback
I appreciate your insights and have addressed each point to ensure the Firebase UI module aligns with Drupal's best practices and maintains compatibility across versions.
โ
src/Controller/FirebaseUiController.php
Feedback: Avoid redeclaring properties already available in
ControllerBase
.Resolution: Removed explicit declarations of
$currentUser
and$entityTypeManager
. Now utilizing inherited methodscurrentUser()
andentityTypeManager()
fromControllerBase
.โ
src/Controller/ServiceWorkerController.php
Feedback: Avoid using
\Drupal::currentUser()
directly; instead, inject dependencies.Resolution: Implemented
ContainerInjectionInterface
and injected thecurrent_user
service through the constructor, following Drupal's dependency injection best practices.โ
src/Entity/FirebaseNotification.php
Feedback: Consider using PHP attributes for plugin definitions, especially for Drupal 10.3 and above.
Resolution: Retained annotations to maintain compatibility with Drupal 8 and 9. Plan to transition to PHP attributes in the future to support Drupal 10.3 and above, ensuring broader compatibility.
โ
src/Form/FirebaseUISettingsForm.php
Feedback: Avoid hardcoding URLs within translatable strings; use placeholders instead.
Resolution: Replaced hardcoded URLs with placeholders using the
:link
syntax in thet()
function. This approach facilitates better localization and translation.โ
src/Plugin/QueueWorker/FirebaseNotificationQueueWorker.php
Feedback: Inject dependencies using the dependency injection container instead of static service calls.
Resolution: Implemented
ContainerFactoryPluginInterface
to inject necessary services via the constructor, aligning with Drupal's standards for service management.These adjustments ensure that the Firebase UI module adheres to Drupal's coding standards and best practices, maintaining compatibility with Drupal 8.8 and above. Please let us know if there are any further areas that require attention or improvement.
- ๐ฎ๐นItaly apaderno Brescia, ๐ฎ๐น
Thank you for your contribution and for your patience with the review process!
I am going to update your account so you can opt into security advisory coverage any project you create, including the projects you already created.
These are some recommended readings to help you with maintainership:
- Dries โ ' post on Responsible maintainers
- Maintainership โ
- Git version control system โ
- Issue procedures and etiquette โ
- Maintaining and responding to issues for a project โ
- Release naming conventions โ .
You can find more contributors chatting on Slack โ or IRC โ in #drupal-contribute. So, come hang out and stay involved โ !
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review โ . I encourage you to learn more about that process and join the group of reviewers.I thank the dedicated reviewers as well.