Problem/Motivation

It is a big challenge for some site to go to group 3.x and they already have unsupported warning with this module so going to group 2.x is the easier way. And group_notify do not support that version at least there few issues about that.

Steps to reproduce

In your site which already have installed the module group and group_notify update group to 2.x and group_notify to 2.0.0-beta1, then you will see error about unfound entity type 'group_relationship'.

Proposed resolution

In seems the only issue in this module is about the entity_type_id we provide to services, currently the module use 'group_relationship' for the version 3 need. We can make it generic the module check the version of group and give the entity_type_id.

Remaining tasks

Make a patch or MR.

User interface changes

NA

API changes

NA

Data model changes

NA

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

diaodiallo created an issue. See original summary.

diaodiallo’s picture

Status: Active » Needs review
StatusFileSize
new4.45 KB

Here is a patch to support both versions.

phjou’s picture

The requirement in the info file also makes it impossible to use:
dependencies:
- group:gnode (>=3.2.0)

I am not sure why that has been added but it seems too restrictive. Version 2 is still supported by group.

phjou’s picture

New patch removing the hard requirement in the info file.

But the legitimate question is should we have 2 different branches like the Group module?

phjou’s picture

StatusFileSize
new4.82 KB

That's the patch for the beta1 if people need it since the release add some lines at the bottom of the info file that are not in the repo.

phjou’s picture

StatusFileSize
new4.82 KB

EDIT: sorry my browser submitted my answer twice

phjou’s picture

diaodiallo’s picture

Thank you @phjou for your patches, I will check it and let you know.

diaodiallo’s picture

Status: Needs review » Reviewed & tested by the community

I reviewed the patch group-notify-beta1-3436167.patch. I think can go to RTBC.

dww’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs merge request

Thanks for this! Agree this is probably worth doing. However, before this can be committed, this needs some work:

  1. This needs to be converted into a merge request
  2. Given #3558646: Missing schema for NotifyGroupNode configuration settings we might need to do something funky with the config schema so that it works between both V2 and V3. TBD.
  3. I don't love embedding the version_compare() call everywhere. I'd rather add a helper method to group_notify.module that returns the right string and then use that helper everywhere.
  4. We now have a composer.json file so we can do more accurate version constraints. We need to alter that, instead of messing with group_notify.info.yml

Thanks again! I hope to get this resolved before the next 2.0.0 release (which I aim to be rc1).

dww’s picture

Assigned: Unassigned » dww

I'm working on this now, stay tuned.

dww’s picture

Issue tags: -Needs merge request

MR !13 resolves all my concerns in #10:

  1. It's an MR 😂
  2. Confirmed that the schema definition from V3 will also work with V2. That didn't change in Group Core. 🎉
  3. Added helper functions instead of embedding version_compare() everywhere.
  4. Adds the right constraints to composer.json

Also expanded .gitlab-ci.yml to add a bunch of manual build/test jobs for various combinations, and added a default build/test for D10.5 + Group 2.3.x.

All that seems to be fine. However, this is concerning:

https://git.drupalcode.org/project/group_notify/-/jobs/7360162

Fails locally, too. #3558643: Add basic notification test coverage is failing with:

There was 1 failure:
1) Drupal\Tests\group_notify\Functional\GroupNotifyTest::testGroupNotify
Failed asserting that actual size 0 matches expected size 2.
/builds/project/group_notify/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:122
/builds/project/group_notify/vendor/phpunit/phpunit/src/Framework/Constraint/Constraint.php:56
/builds/project/group_notify/tests/src/Functional/GroupNotifyTest.php:213
/builds/project/group_notify/vendor/phpunit/phpunit/src/Framework/TestResult.php:729
FAILURES!

That's where the test posted an article to a group, and expected notifications to go out to 2 group members, but no emails were found. Perhaps the test itself is broken in Group V2, but perhaps something else more sinister is broken...

I'll keep digging for now.

dww’s picture

Status: Needs work » Needs review

Huzzah. So glad I added GroupNotifyTest. 😅 This was indeed broken, and not sending any notifications with Group V2. That's because in Group V3 we rely on group_notify_group_relationship_insert() to notice when something is added to a group. But that entity doesn't exist in Group V2, and we need to also implement group_notify_group_content_insert():

https://git.drupalcode.org/project/group_notify/-/merge_requests/13/diff...

With that change, the test is passing locally. Let's see what the bot thinks...

dww’s picture

Status: Needs review » Reviewed & tested by the community

Yay, https://git.drupalcode.org/project/group_notify/-/pipelines/665530 is happy everywhere. I'm going to merge this.

  • dww committed bc270b59 on 2.0.x
    feat: #3436167 Add compatibility with Group V2 API
    
    Co-authored-by: @dww...
dww’s picture

Assigned: dww » Unassigned
Status: Reviewed & tested by the community » Fixed

Thanks @diaodiallo and @phjou for getting this started! This will now be included in the next 2.0.x release.

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.

Status: Fixed » Closed (fixed)

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