forked from otwcode/otwarchive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AO3-6712 Allow invites to be resent and index invitee_email (otwcode#…
…4791) * AO3-6712 Revert AO3-6666 This reverts commit 7e15f32. * AO3-6712 Add invitee email index to invitations * AO3-6712 Make sure button has hover style and i18n * AO3-6712 Normalize * AO3-6712 Fix a mistake * AO3-6712 Fix step that was looking for value instead of label text
- Loading branch information
Showing
18 changed files
with
274 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<!--Descriptive page name, messages and instructions--> | ||
<h2 class="heading" id="invite-heading"> | ||
<%= t(".title", email: invitation.invitee_email) %> | ||
</h2> | ||
<!--/descriptions--> | ||
|
||
<!--main content--> | ||
<p> | ||
<% status = invitation.resent_at ? "resent" : "not_resent" %> | ||
<%= t(".info.#{status}", | ||
sent_at: l((invitation.sent_at || invitation.created_at).to_date), | ||
resent_at: invitation.resent_at ? l(invitation.resent_at.to_date) : nil) %> | ||
</p> | ||
|
||
<p> | ||
<% if invitation.can_resend? %> | ||
<%# i18n-tasks-use t("invite_requests.invitation.after_cooldown_period.not_resent") | ||
i18n-tasks-use t("invite_requests.invitation.after_cooldown_period.resent_html")-%> | ||
<% status = invitation.resent_at ? "resent_html" : "not_resent" %> | ||
<%= t(".after_cooldown_period.#{status}", | ||
count: ArchiveConfig.HOURS_BEFORE_RESEND_INVITATION, | ||
contact_support_link: link_to(t(".contact_support"), new_feedback_report_path)) %> | ||
<%= button_to t(".resend_button"), resend_invite_requests_path(email: invitation.invitee_email) %> | ||
<% else %> | ||
<%= t(".before_cooldown_period", count: ArchiveConfig.HOURS_BEFORE_RESEND_INVITATION) %> | ||
<% end %> | ||
</p> | ||
<!--/content--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<p class="notice"> | ||
<%= t(".email_not_found") %> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
<%= render "invite_request", invite_request: @invite_request %> | ||
<% if @invite_request %> | ||
<%= render "invite_request", invite_request: @invite_request %> | ||
<% elsif @invitation %> | ||
<%= render "invitation", invitation: @invitation %> | ||
<% else %> | ||
<%= render "no_invitation" %> | ||
<% end %> | ||
|
||
<p> | ||
<%= ts("To check on the status of your invitation, go to the %{status_page} and enter your email in the space provided!", status_page: link_to("Invitation Request Status page", status_invite_requests_path)).html_safe %> | ||
<%= t(".instructions_html", status_link: link_to("Invitation Request Status page", status_invite_requests_path)) %> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,14 @@ | ||
<% if @invite_request %> | ||
$j("#invite-status").html("<%= escape_javascript(render "invite_requests/invite_request", invite_request: @invite_request) %>"); | ||
<% elsif @invitation %> | ||
$j("#invite-status").html("<%= escape_javascript(render "invitation", invitation: @invitation) %>"); | ||
|
||
<%# Correct heading size for JavaScript display %> | ||
$j(document).ready(function(){ | ||
$j('#invite-heading').replaceWith(function () { | ||
return '<h3 class="heading">' + $j(this).html() + "</h3>"; | ||
}); | ||
}) | ||
<% else %> | ||
$j("#invite-status").html("<p>Sorry, we can't find the email address you entered. If you had used it to join our invitation queue, it's possible that your invitation may have already been emailed to you; please check your spam folder, as your spam filters may have placed it there.</p>"); | ||
$j("#invite-status").html("<%= escape_javascript(render "no_invitation") %>"); | ||
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,7 @@ | |
collection do | ||
get :manage | ||
get :status | ||
post :resend | ||
end | ||
end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class AddResentAtToInvitations < ActiveRecord::Migration[6.1] | ||
uses_departure! if Rails.env.staging? || Rails.env.production? | ||
|
||
def change | ||
add_column :invitations, :resent_at, :datetime | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class AddIndexToInvitations < ActiveRecord::Migration[6.1] | ||
uses_departure! if Rails.env.staging? || Rails.env.production? | ||
|
||
def change | ||
add_index :invitations, :invitee_email | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,7 +57,7 @@ Feature: Invite queue management | |
# check your place in the queue - invalid address | ||
When I check how long "[email protected]" will have to wait in the invite request queue | ||
Then I should see "Invitation Request Status" | ||
And I should see "If you can't find it, your invitation may have already been emailed to that address; please check your email spam folder as your spam filters may have placed it there." | ||
And I should see "Sorry, we can't find the email address you entered." | ||
And I should not see "You are currently number" | ||
|
||
# check your place in the queue - correct address | ||
|
@@ -98,7 +98,7 @@ Feature: Invite queue management | |
Then 1 email should be delivered to test@archiveofourown.org | ||
When I check how long "[email protected]" will have to wait in the invite request queue | ||
Then I should see "Invitation Request Status" | ||
And I should see "If you can't find it, your invitation may have already been emailed to that address;" | ||
And I should see "If you can't find it, please check your email spam folder as your spam filters may have placed it there." | ||
|
||
# invite can be used | ||
When I am logged in as an admin | ||
|
@@ -155,3 +155,29 @@ Feature: Invite queue management | |
And I fill in "invite_request_email" with "[email protected]" | ||
And I press "Add me to the list" | ||
Then I should see "Email is already being used by an account holder." | ||
|
||
Scenario: Users can resend their invitation after enough time has passed | ||
Given account creation is enabled | ||
And the invitation queue is enabled | ||
And account creation requires an invitation | ||
And the invite_from_queue_at is yesterday | ||
And an invitation request for "[email protected]" | ||
When the scheduled check_invite_queue job is run | ||
Then 1 email should be delivered to invitee@example.org | ||
|
||
When I check how long "[email protected]" will have to wait in the invite request queue | ||
Then I should see "Invitation Request Status" | ||
And I should see "If you can't find it, please check your email spam folder as your spam filters may have placed it there." | ||
And I should not see "Because your invitation was sent more than 24 hours ago, you can have your invitation resent." | ||
And I should not see "Resend Invitation" | ||
|
||
When all emails have been delivered | ||
And it is currently 25 hours from now | ||
And I check how long "[email protected]" will have to wait in the invite request queue | ||
Then I should see "Invitation Request Status" | ||
And I should see "If you can't find it, please check your email spam folder as your spam filters may have placed it there." | ||
And I should see "Because your invitation was sent more than 24 hours ago, you can have your invitation resent." | ||
And I should see "Resend Invitation" | ||
|
||
When I press "Resend Invitation" | ||
Then 1 email should be delivered to invitee@example.org |
Oops, something went wrong.