Problem/Motivation

Two hook implementations in myrest.module change the behaviour of the whole site rather than of this module's endpoints.

  • myrest_mail_alter() replaces $message['body'][0] of every contact message with key page_mail. A site that uses the core contact form for anything — a support address, an editorial workflow — silently loses the body of its mail and gets this module's sentence instead. Nothing in the interface says so.
  • myrest_toolbar_alter() attaches a library to $items['admin_toolbar_tools'] without checking that the key exists. Without the admin_toolbar_tools module it creates a toolbar item consisting of nothing but an attachment.

Proposed resolution

  • Scope the mail alter to messages this module sent: mark them when the submission resource sends them and act only on that mark. A site whose own contact form sends mail is untouched.
  • Decide whether the replacement text is wanted at all, or whether it belongs to the resource that composes the message; the current text describes a form submission, which is what the resource does.
  • Guard the toolbar alter with a check for the item, and for the module that provides it.
  • Cover both: a contact message sent outside this module keeps its body, and the toolbar alter is a no-op without the toolbar module.

Remaining tasks

Everything. Found while auditing what the module changes outside its own endpoints.

Issue fork myrest-3618257

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:

Comments

sergeydruua created an issue. See original summary.

  • sergeydruua committed 53c77155 on 1.0.x
    Issue #3618257: Scope the mail and toolbar alters to what this module...
sergeydruua’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

sergeydruua’s picture

Status: Fixed » Closed (fixed)