Problem/Motivation
In 3.0.7, the project's composer.json declares both drupal/message and drupal/message_notify as hard requirements:
"require": { "php": >=8.1", "drupal/message": "^1.0", "drupal/message_notify": "^1.0" }
As far as I can tell, neither is needed by the main module:
- private_message.info.yml declares only
drupal:text— it does not require any other contributed module to be enabled. - The only place either package is needed is the optional
private_message_notifysubmodule, whoseprivate_message_notify.info.ymldeclaresmessage_notify:message_notify. - 3.x removed the
private_message.notifierservice and theMessage-entity notification model altogether, replacing them withhook_private_message_new_message(). So the main module has no remaining caller for either package.
On top of that, the drupal/message line looks redundant even for the submodule's sake: drupal/message_notify already requires drupal/message: ^1.0 itself, so it would be pulled in transitively anyway.
If this list is produced by the Drupal.org packaging script folding submodule dependencies into the parent package, that would explain how it got there — in which case the question is whether that outcome is intended, rather than whether the file is wrong.
Practical effect
Sites that use private messaging without the notify submodule still get two extra contributed projects installed and carried through every update, with no code path using them. In our case we route notifications through our own system and have never enabled private_message_notify, yet both packages remain in vendor/ after uninstalling the modules at the Drupal level.
It is a cosmetic problem rather than a functional one — nothing breaks — but it does make dependency review harder, and it is surprising when a module's own .info.yml requires nothing while its composer.json requires two projects.
Prior discussion
#2980026 proposed removing composer.json entirely and was closed as works as designed, with the note that the file is "required, due to various dependencies". That was accurate for 2.x, where the main module genuinely consumed message_notify through private_message.notifier. Since 3.x dropped that service, I think the situation is materially different — hence a fresh issue rather than reopening that one.
Questions for the maintainers
- Is the current
requireblock intentional — for example, to keep the notify submodule installable without extra steps? - If it is a side effect of submodule dependency folding, is that something you would want to change?
- Would you be open to moving these to
suggest, or to splittingprivate_message_notifyinto its own project (as was already done forprivate_message_flood_protectionandprivate_message_nodejs)? - At minimum, would dropping the redundant
drupal/messageline be acceptable, givendrupal/message_notifyalready requires it?
Happy to provide a merge request for whichever direction you prefer. I am not proposing a behaviour change — only asking whether the dependency declaration still reflects what 3.x actually needs.
Steps to reproduce
composer require drupal/private_message:3.0.7on a site that will not enableprivate_message_notify.- Observe that
drupal/messageanddrupal/message_notifyare installed. - Enable only
private_message; note that neither of the other two modules needs to be enabled for it to work. - Uninstall
messageandmessage_notifyin Drupal; note the packages remain invendor/and are reinstalled on everycomposer install.
Environment
Drupal 10, private_message 3.0.7, message 1.8.0, message_notify 1.5.0.
Claude Opus 5 was used to assist with investigation of my finding, then for composing the title and description of the ticket.
Issue fork private_message-3618188
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:
Comments
Comment #2
loze commentedComment #4
loze commentedThis applies to 4.x unchanged: composer.json on the 4.x head still requires drupal/message and drupal/message_notify while private_message.info.yml depends only on drupal:text. Moving both to suggest is right.
The composer requirement is one piece of a larger leftover. When the sending moved into private_message_notify, three other things that only the submodule uses stayed in the main module:
src/Form/ConfigForm.phplines 72 to 136: "Enable notifications", "Default action", "Send notifications of new messages in a thread" and the away time. The form already loadsPrivateMessageConfigFormplugins from other modules, so this section belongs in a plugin shipped by private_message_notify.private_message.modulelines 352 to 466. They store three per-user preferences in user data that only the submodule reads. Both belong inprivate_message_notify.module.private_message.settingsand its schema. They can stay where they are for now, since moving them needs an update path; the two items above can move without touching stored config.The only reader of any of this is
PrivateMessageNotifier::shouldSend()in the submodule. With private_message_notify disabled, a site still gets the full settings section and every user gets the opt-in fieldset, and nothing is ever sent. It reads as if the module emails on its own.So the fix for this issue is: composer.json to suggest, the settings section into a plugin in the submodule, the user fieldset and handler into the submodule. Three files plus one new one, no config migration.
Comment #5
loze commented