-
-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport 'Fix conference invitations' to v0.27 (#10003)
* Fix conference invitations * Fix conference invitations * Clarify the unauthorized errors when accepting/rejecting conference invitation * Fix redirecting back to the same URL (accept/reject) after sign in * Clarify the conference invitation text when inviting a new user * Fix decline conference invitation link * Add spaces to the links * Fix re-joining already joined conference In case the user already joined the conference, broadcast ok. * Change the i18n key for invite existing users * Add omitted value in keyword argument * Add omitted value in keyword argument Co-authored-by: Antti Hukkanen <antti.hukkanen@mainiotech.fi>
- Loading branch information
1 parent
788f402
commit 0e07750
Showing
11 changed files
with
128 additions
and
9 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
6 changes: 3 additions & 3 deletions
6
...erences/app/views/decidim/conferences/admin/invite_join_conference_mailer/invite.html.erb
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,12 +1,12 @@ | ||
<p class="email-greeting"><%= t("devise.mailer.invitation_instructions.hello", email: @user.name) %></p> | ||
|
||
<p class="email-instructions"> | ||
<%= t ".invited_you_to_join_a_conference", invited_by: @invited_by.name, application: @user.organization.name %> | ||
<%= t ".invited_existing_user_to_join_a_conference", invited_by: @invited_by.name, application: @user.organization.name %> | ||
</p> | ||
|
||
<p class="email-button email-button__cta cta-decline"> | ||
<%= link_to t(".decline", conference_title: translated_attribute(@conference.title)),routes.decline_invitation_conference_registration_type_conference_registration_path(conference_slug: @conference.slug, registration_type_id: @registration_type.id) %> | ||
<%= link_to t(".decline", conference_title: translated_attribute(@conference.title)), routes.decline_invitation_conference_registration_type_conference_registration_url(conference_slug: @conference.slug, registration_type_id: @registration_type.id) %> | ||
</p> | ||
<p class="email-button email-button__cta cta-accept"> | ||
<%= link_to t(".registration", conference_title: translated_attribute(@conference.title)),routes.conference_registration_type_conference_registration_url(conference_slug: @conference.slug, registration_type_id: @registration_type.id) %> | ||
<%= link_to t(".registration", conference_title: translated_attribute(@conference.title)), routes.conference_registration_type_conference_registration_url(conference_slug: @conference.slug, registration_type_id: @registration_type.id) %> | ||
</p> |
4 changes: 2 additions & 2 deletions
4
decidim-conferences/app/views/devise/mailer/join_conference.html.erb
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
4 changes: 2 additions & 2 deletions
4
decidim-conferences/app/views/devise/mailer/join_conference.text.erb
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
63 changes: 63 additions & 0 deletions
63
decidim-conferences/spec/commands/admin/invite_user_to_join_conference_spec.rb
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,63 @@ | ||
# frozen_string_literal: true | ||
|
||
require "spec_helper" | ||
|
||
module Decidim::Conferences::Admin | ||
describe InviteUserToJoinConference do | ||
let(:command) { described_class.new(form, conference, invited_by) } | ||
|
||
let(:conference) { create :conference } | ||
let(:invited_by) { create :user, :admin, :confirmed, organization: conference.organization } | ||
let(:invited_user) { create :user, :confirmed, organization: conference.organization } | ||
let(:form) do | ||
double( | ||
invalid?: invalid, | ||
existing_user: true, | ||
current_organization: conference.organization, | ||
user: invited_user, | ||
registration_type: registration_type | ||
) | ||
end | ||
let(:invalid) { false } | ||
let(:registration_type) { create(:registration_type, conference: conference) } | ||
|
||
describe "call" do | ||
it "broadcasts ok" do | ||
expect { command.call }.to broadcast(:ok) | ||
end | ||
|
||
it "sends the invitation to the existing user" do | ||
perform_enqueued_jobs { command.call } | ||
|
||
email = last_email | ||
expect(email.to).to eq([invited_user.email]) | ||
expect(email.subject).to eq("Invitation to join a conference") | ||
end | ||
|
||
describe "when the user is a new user" do | ||
let(:form) do | ||
double( | ||
invalid?: invalid, | ||
existing_user: false, | ||
current_organization: conference.organization, | ||
email: "jdoe@example.org", | ||
name: "John Doe", | ||
registration_type: registration_type | ||
) | ||
end | ||
|
||
it "broadcasts ok" do | ||
expect { command.call }.to broadcast(:ok) | ||
end | ||
|
||
it "sends the invitation to the user" do | ||
perform_enqueued_jobs { command.call } | ||
|
||
email = last_email | ||
expect(email.to).to eq(["jdoe@example.org"]) | ||
expect(email.subject).to eq("Invitation to join a conference") | ||
end | ||
end | ||
end | ||
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
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