FIX: Resend only pending invites (#13403)

The Resend Invites button used to resend expired invites too, which was
unexpected because the button was on the Pending Invites page.
This commit is contained in:
Dan Ungureanu
2021-06-17 10:45:53 +03:00
committed by GitHub
parent c893b20298
commit 007e166d13
2 changed files with 6 additions and 8 deletions

View File

@@ -290,12 +290,8 @@ class InvitesController < ApplicationController
def resend_all_invites
guardian.ensure_can_resend_all_invites!(current_user)
Invite
.left_outer_joins(:invited_users)
.where(invited_by: current_user)
Invite.pending(current_user)
.where('invites.email IS NOT NULL')
.where('invited_users.user_id IS NULL')
.group('invites.id')
.find_each { |invite| invite.resend_invite }
render json: success_json