Problem/Motivation
drupal_get_message() and drupal_set_message() replaced by Messenger service, see https://www.drupal.org/node/2774931

Proposed resolution
Replace existing calls to the drupal_set_message() function with calls to the Messenger service

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes
None.

API changes
None.
Data model changes
None.

Comments

subson created an issue. See original summary.

subson’s picture

Issue summary: View changes
subson’s picture

Status: Active » Needs review
StatusFileSize
new24.25 KB

Adding patch for review.

Status: Needs review » Needs work

The last submitted patch, 3: simplenews-replace-drupal-set-message-2981287-3.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tr’s picture

In addition to what the testbot is telling about the duplicate MessengerTrait, almost all of the t() should be replaced by $this->t().

subson’s picture

Status: Needs work » Needs review
StatusFileSize
new23.49 KB
new918 bytes

Fixing the duplicate MessengerTrait issue, will create a separate issue for t() replacement with $this->t() as there are lot of references of it in the code.

subson’s picture

Separate issue created for $this->t() change - #3002237: Replace usage of t() with $this->t()

subson’s picture

Status: Needs review » Needs work

The last submitted patch, 6: simplenews-replace-drupal-set-message-2981287-6.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

tr’s picture

almost all of the t() should be replaced by $this->t()

will create a separate issue for t() replacement with $this->t()

I didn't mean you should fix all the t() in the entire module at the same time as you introduced the messenger service, I meant your NEW code should not use t(). Likewise, it shouldn't use array(). All the NEW code should conform to the coding standards 100%, otherwise you've just created more things that need to be fixed "later". We shouldn't have to change the same lines of code three times (once for messenger, once for t(), once for array() ...), and we shouldn't be committing code with known problems when it's trivial to avoid those problems altogether.

adamps’s picture

Status: Needs work » Reviewed & tested by the community

@TR You make some excellent general points. However in this specific case, I would like to put forward an alternative point of view. This patch is itself a tidy up issue. The patch does not really write NEW code, it simply does a bunch of search and replace.

I think that if we block fixing one type of tidy up because another type of tidy up is required then it becomes hard to ever tidy up. I don't think it's entirely trivial to fix all the t() and array() as well. I think the patch becomes harder to review if it includes all of those too.

The patch has not "just created more things that need to be fixed later", but in fact exactly the opposite, less of them. There are the same number of problems with t() and array() as before but all the deprecation warnings have gone. Clearly the code is in a better state than before - it removes a lot of irritating junk from the output of running tests.

I vote for commit.

adamps’s picture

Assigned: subson » Unassigned

I plan to commit this in one week unless there is some new objection.

tr’s picture

The status was at "Needs work" solely because the tests failed - I did not set the status, and I was not blocking the issue. As the maintainer, it's up to you how you want to manage the project.

adamps’s picture

Thanks @TR. I have only just become a maintainer this week, so whilst I am learning my way I am keen to check I don't create problems for others.

adamps’s picture

Issue tags: +Plan to commit

  • d53b8bd committed on 8.x-1.x
    Issue #2981287 by subson, AdamPS, TR: Replace usages of the deprecated...
adamps’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -Plan to commit

Status: Fixed » Closed (fixed)

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