-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #3453509: Make modules responsible for their own message request fields #3923
base: main
Are you sure you want to change the base?
Issue #3453509: Make modules responsible for their own message request fields #3923
Conversation
93ce964
to
a56a7ca
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do see an issue here, the current implementation is making sure that each new group type has the field_grequest_message field, the field is then used is GroupRequestMembershipRequestForm.
With your change we cannot longer assume that this field exists, the field would need to be created by the user when creating the new group type. There are also other implementations referencing this field , for example SocialGroupRequestConfigOverride. So we cannot just remove the hook without at least adding checks to classes mentioned above to check if the field is present in the group type.
For me the current implementation, makes sense, the module relies on field being there so it basically enforce it via hook. If entity_type and field_name are missing can't we just add that instead of removing the hook ? If only the tests are the issue then for me this is an indication that something is missing in the tests it self or the error is in the test.
Hi, @nkoporec | With your change we cannot longer assume that this field exists, the field would need to be created by the user when creating the new group type | If entity_type and field_name are missing can't we just add that instead of removing the hook ? | If only the tests are the issue then for me this is an indication that something is missing in the tests it self or the error is in the test. Discussion in slack about it https://opensocial.slack.com/archives/C0RQ56PFX/p1717575097345489 |
I slightly reframed the problem statement in the PR (we likely want to update the Drupal.org issue to match). I hope this change in problem statement shows why removing the hook itself is the correct way forward. Nejc is right that if we have other pieces of code that reference this field, then removing the hook is not enough to make this work.
The other place where this field is referenced in the distribution is It's unfortunate that we're running into some scope creep here. However, I think the underlying issue is tech debt that we're now encountering for at least a second time. So I also think that that, combined with the path of tackling them in clearly scoped PRs, is a good reason to clean up the tech debt now and not push it forward any longer. (As a bonus, if we fix the form in |
We should remove social_group_request_group_content_type_insert hook, because: 1. This hook is incorrect since it creates the field without entity_type and field_name, which leads to problems with kernel tests 2. We don't want to create this field for each group_content type So, we put field_request_message into optional folder where it needed. So, we have list of these modules, which have own group type: 1. social_discussion_group - has own group type, but doesn't have group_membership_request plugin, which means we don't need to put field_request_message field 2. social_course_advanced_request - has social_group_request module in depedencies and field config in /install 3. social_course_basic_request - has social_group_request module in depedencies and field config in /install 4. social_discussion_secret_group - has own group type, but doesn't have group_membership_request plugin, which means we don't need to put field_request_message field 5. social_flexible_group - put field in /optional, since this module doesn't have social_group_request in depedencies
a56a7ca
to
eae0c34
Compare
Related PRs
#3937
#3928
Problem
We currently have a hook in
social_group_request
which adds a field to all group types that use the "Request Access" plugin. This creates problems for group types where a different request flow is needed and where we don't want the "Message" field.We tried to be clever in the past because we initially had 4 group bundles that were different group types and we wanted to share behavior between them.
Since then we've understood that that's not a maintainable solution and we want to have these kind of functionalities be opt-in (our only "group" type is now also
flexible_group
rather than open/public/closed/secret)The automatic generation also creates other problems because it creates config in an install hook that other modules might depend on. This works if we install modules one-by-one using Drush but it doesn't work well if we install the module during tests because these hooks may not fire before the config is attempted to be imported from
config/install
folders.Solution
The solution is to remove the magic hook here and instead add the config files to config/optional in the different modules that support group requests (e.g.
social_group_flexible_group
,social_course
, etc.). That way ifsocial_group_request
is enabled Drupal will automatically install the config at the right moment.So, we put field_request_message into the optional folder where it is needed. So, we have a list of these modules, which have their own group type:
social_discussion_group
- has own group type, but doesn't havegroup_membership_request
plugin, which means we don't need to putfield_request_message
fieldsocial_course_advanced_request
- hassocial_group_request
module in dependencies and field config in/install
social_course_basic_request
- hassocial_group_request
module in dependencies and field config in/install
social_discussion_secret_group
- has own group type, but doesn't havegroup_membership_request
plugin, which means we don't need to putfield_request_message
fieldsocial_flexible_group
- put field in/optional
, since this module doesn't havesocial_group_request
in dependenciesIssue tracker
https://www.drupal.org/project/social/issues/3453509
Theme issue tracker
N/A
How to test
social_group module
social_group_flexible_group
social_group_request
moduleIt would be better to test also for social courses
Screenshots
N/A
Release notes
Change Record
N/A
Translations
N/A