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

Bug 5901 fix resend invitation from create invite #7790

Conversation

ZachHandley
Copy link

@ZachHandley ZachHandley commented Mar 11, 2024

I merged heads to resolve the merge conflicts and check something in my code to make sure I didn't see a bug, and that closed my pull request, so anyways this one says it can merge automatically @stnguyen90 sorry about the closed one

What does this PR do?

Adds a new call into the createMembership endpoint that checks the database for an unconfirmed membership with the same userEmail. If they don't exist, it creates a membership like normal, which will throw a duplicate error like normal if the users email exists.

If they do exist, it will set the $membership to the found membership, and set the attribute invited to DateTime::now(), then updates the user and it continues onward like normal then sends the email, many success!

Test Plan

The only possible problem this could have was in the $dbForProject->updateDocument (with the $collectionId or something being included like in the client SDK's was my thought) but I have looked at the other code in the teams.php file and they seem to be doing things the same way, so it shouldn't conflict at all.

Related PRs and Issues

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

… not confirmed their invite

- Added a boolean for shouldCreate or shouldUpdate essentially
- Checks for a user in the database by looking at memberships with the same user email that aren't confirmed
- Still throws duplicate error if *confirmed* user with same email exists and this endpoint is attempted to be hit
…ttps://github.com/ZachHandley/appwrite into bug-5901-fix-resend-invitation-from-create-invite

# Conflicts:
#	app/controllers/api/teams.php
Fixed code formatting, I believe I resolved the merge conflicts
app/controllers/api/teams.php Outdated Show resolved Hide resolved
app/controllers/api/teams.php Show resolved Hide resolved
@ZachHandley
Copy link
Author

@stnguyen90 swapped it, sorry for the delay

@stnguyen90 stnguyen90 self-requested a review March 31, 2024 17:00
@stnguyen90 stnguyen90 self-requested a review April 8, 2024 22:42
Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of tests are failing. Maybe your branch is behind?

app/controllers/api/teams.php Outdated Show resolved Hide resolved
@stnguyen90 stnguyen90 self-requested a review April 22, 2024 23:13
Copy link
Contributor

@stnguyen90 stnguyen90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the change has broken some tests.

@stnguyen90 stnguyen90 changed the base branch from main to 1.5.x May 17, 2024 23:31
@stnguyen90 stnguyen90 changed the base branch from 1.5.x to fix-5901-fix-resend-team-invite May 17, 2024 23:32
@stnguyen90 stnguyen90 merged commit 9054bda into appwrite:fix-5901-fix-resend-team-invite May 17, 2024
15 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐛 Bug Report: When trying to resend email in Organization tab it throws AppwriteException
2 participants