Problem/Motivation

When a user requests membership and then becomes a member by some other means, the membership request will still remain.
In this case, the membership request record will be shown in membership requests list and "Already member" is repeated!

Steps to reproduce

  1. As user, request membership to a group
  2. As group administrator, add previous user as member
  3. See pending membership requests. The membership request done in 1 will still be shown even if the user is already a member. The operations will show twice "Already member" but no real action is possible. It is not possible to remove this record.

Proposed resolution

Remove the membership request once the user becomes a member by any means.

CommentFileSizeAuthor
#3 3327576-3.patch1 KBdxvargas

Issue fork grequest-3327576

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

dxvargas created an issue. See original summary.

lobsterr’s picture

Assigned: Unassigned » lobsterr
Category: Task » Feature request

It sounds like a good idea.

dxvargas’s picture

StatusFileSize
new1 KB

I'm proposing a solution now, to have a hook_content_insert() with similar code that already exists for hook_content_delete().
This will check if the entity being inserted is a group membership that matches an existing membership request for the same user and group, in that case it will delete the membership request.
Then I refactored a bit, to not duplicate code.

lobsterr’s picture

@dxvargas, I don't see in your patch the solution, what you described for this ticket. I will work on the solution

dxvargas’s picture

@LOBsTerr did you test it?
With the solution I've proposed, the membership request is deleted once a group admin adds the user to the group. I've tested the steps I've described, after applying the patch, and the record is not visible (step #3).

Anyway, any other solution is welcome. Thanks for the feedback.

lobsterr’s picture

@dxvargas ops, I see now :), but still it requires some improvements.
For the current moment, what would happen we will approve a request, and then we create a membership group content, which will delete group membership request. I think we need to check the status field and we want to be sure that it is not approved yet.

lobsterr’s picture

@dxvargas, I have used your patch and extended it. A group membership request will be removed, if a new group membership was created outside grequest module. For that we check that status of group membership request is still pending. I did a small refactoring and also updated tests accordingly. Please check it and I will tag a new version.

lobsterr’s picture

Status: Active » Needs review
dxvargas’s picture

Status: Needs review » Reviewed & tested by the community

@LOBsTerr, I'm ok with checking the status. I've tested your MR !21, it works as expected. I also agree with the small improvements and the tests changes (both removing testRequestWithMemberAsUser and the new testGroupMembershipInsertion).

I mark this issue as RTBC.

  • LOBsTerr committed 8c5be67a on 1.0.x
    Issue #3327576 by LOBsTerr, dxvargas: Delete request if the user becomes...
lobsterr’s picture

Status: Reviewed & tested by the community » Fixed

Thank you for your review!

  • LOBsTerr committed e040053c on 2.0.x authored by dxvargas
    Issue #3327576 by LOBsTerr, dxvargas: Delete request if the user becomes...

  • LOBsTerr committed eadd68e2 on 2.0.x
    Issue #3327576 by LOBsTerr, dxvargas: Delete request if the user becomes...

  • LOBsTerr committed 864e2943 on 3.0.x authored by dxvargas
    Issue #3327576 by LOBsTerr, dxvargas: Delete request if the user becomes...

Status: Fixed » Closed (fixed)

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