Skip to content
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 #3345231 by zanivdmar: Missing option to accept invite #3326

Merged
merged 7 commits into from
Mar 17, 2023

Conversation

zanvidmar
Copy link
Contributor

@zanvidmar zanvidmar commented Mar 1, 2023

Problem

Invited user is missing option to accept/reject invitation when they are invited to "request to join" group.

Solution

Which "join plugin" is initiated with given group can be determined by field or by method. Flexible groups are defining this by field_group_allowed_join_method "Join methods". In the code, there was already predicted that If user has a pending invite, we should skip the request button and go to "fallback" added join method, but that never worked since #2658. To fix this we added added join method as something that is always available for flexible groups despite and in addition to what is selected by "Join methods"

Code explanation

social_group_invite.module

Screenshot 2023-03-01 at 15 13 29

Screenshot 2023-03-01 at 15 20 43

Users with certain permissions (SM/GM) can always invite users (member management feature), despite what join method is selected per flexible group. Join options are provided by plugins and which plugins are initiated per entity type, can be defined by field (for example by field_group_allowed_join_method in flexible groups) or by method. If something is defined by field, this is considered as something that user can determine while methods are a bit more predefined.
In this part of code, we are simply adding added join method in addition to what is selected by "Join methods". The only case where adding the added method is actually used, is when "Request to join" option in "Join methods" is selected.

social_group.module
On flexible group create (group/add/flexible_group), there is "Join methods" field which is expected to list of radio buttons. Because we added added method to the conditions that triggers the code below are not met anymore.

      if ($field['#type'] === 'checkboxes') {
        $field['#type'] = 'radios';
      }

Ideally we should check differently, when we should show checkboxes, but this piece of code was introduced as something that disturbs the process flow as less as possible as this has effect on all the groups.

SocialGroupRequestJoin.php
This piece of code is checking whether "fallback" invite buttons should be shown instead of request to join.
uid has been changed to entity_id because we are interested if current user has invitation and not if current user created invitation. invitation_status was introduced to narrow down only pending invitations.

Issue tracker

3345231

Related issue on social course 3345506

Theme issue tracker

N/A

How to test

  • Clean install of Open social
  • As a site manager create a new group where "Join methods" is "Request to join"
  • As a group/site manager invite logged in user to join the group via group/{group_id}/membership > Add member > Invite users.
  • As logged in user you will get notification in notification center that you are invited to group.
  • As logged in user click on notification and you will be redirected to group/{group_id}/stream where "Request to join" button will be shown which is a bug.
  • The expected result with button to accept/reject button is attained when repeating the steps with this fix applied.

Additional tests

  • use this patch from the issue 3345506
  • Test all other joining methods flows within flexible group in combination whit or without site/group manager invite.
  • Test all joining methods also with all other groups (public, open, closed, courses,..) and check if the fields on the create/edit form of this entity types are exactly the same with or without this fix applied.

Definition of done

Before merge

  • Code/peer review is completed
  • All commit messages are clear and clean. If applicable a rebase was performed
  • All automated tests are green
  • Functional/manual tests of the acceptance criteria are approved
  • All acceptance criteria were met
  • New features or changes to existing features are covered by tests, either unit (preferably) or behat
  • Update path is tested. New hook_updates should respect update order, right naming convention and consider hook_post_update code
  • Module can be safely uninstalled. Update/implement hook_uninstall and make sure that removed configuration or dependencies are removed/uninstalled
  • This pull request has all required labels (team/type/priority)
  • This pull request has a milestone
  • This pull request has an assignee (if applicable)
  • Any front end changes are tested on all major browsers
  • New UI elements, or changes on UI elements are approved by the design team
  • New features, or feature changes are approved by the product owner

After merge

  • Code is tested on all branches that it has been cherry-picked
  • Update hook number might need adjustment, make sure they have the correct order
  • The Drupal.org ticket(s) are updated according to this pull request status
  • Check the remaining tasks on 3345506

Screenshots

actual
expected

Release notes

Invited user is missing option to accept/reject invitation when they are invited to "request to join" flexible group. This regression is fixed by this update.

Change Record

N/A

Translations

N/A

  • Changed or removed source strings are added to the translations.php file.

…oup joining option is only by request while user is invited by group/site manager.
@mergeable
Copy link

mergeable bot commented Mar 1, 2023

Thanks for contributing towards Open Social! A maintainer from the @goalgorilla/maintainers group might not review all changes from all teams/contributors. Please don't be discouraged if it takes a while. In the meantime, we have some automated checks running and it might be that you will see our comments with some tips or requests to speed up the review process. 😊

@zanvidmar zanvidmar self-assigned this Mar 1, 2023
@zanvidmar zanvidmar added this to the 11.7.4 milestone Mar 1, 2023
@zanvidmar zanvidmar added team: guardians status: needs review This pull request is waiting for a requested review labels Mar 1, 2023
@zanvidmar zanvidmar changed the title issuer #3345231 by zanivdmar: Missing option to accept invite Issue #3345231 by zanivdmar: Missing option to accept invite Mar 1, 2023
@zanvidmar zanvidmar added prio: medium type: bug Fixes a bug in Open Social and removed prio: high labels Mar 1, 2023
@zanvidmar zanvidmar marked this pull request as ready for review March 2, 2023 14:33
@BiaInacio
Copy link
Contributor

Test done, Group invitation is working as expected:
image

@robertragas
Copy link
Contributor

As the 4 behat tests also say there is now an issue when creating a flexible group that is "open to join", this shows for regular users as "invitation only".
Screenshot 2023-03-08 at 10 27 10
Screenshot 2023-03-08 at 10 27 31

@robertragas robertragas self-requested a review March 8, 2023 09:30
…open to join", shows for regular users as "invitation only".
… defined by field_group_allowed_join_method.
@tbsiqueira tbsiqueira modified the milestones: 11.7.4, 11.7.5 Mar 14, 2023
@zanvidmar zanvidmar merged commit a0e891e into main Mar 17, 2023
@zanvidmar zanvidmar deleted the issue/prod-24245-missing-invite-options branch March 17, 2023 09:44
@zanvidmar
Copy link
Contributor Author

zanvidmar commented Mar 17, 2023

🍒 Cherry-picked to 11.7.x here:
c58b8dde0
c194659e7
8ba020be5
13fb8e98a
ba2e5655f
7426e3d1b
9728bcb95

🍒 Cherry-picked to 11.8.x here:
7ab530456
43bdbb7c5
7839fbff0
6db1b6607
a8eaed72b
7a1d7c21f
3fa5c77ed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio: medium status: needs review This pull request is waiting for a requested review team: guardians type: bug Fixes a bug in Open Social
4 participants