[deploy] Fix up connect group issues (#7051)

* Fix up connect group issues

* Fix spec

* Fix spec
This commit is contained in:
Ben Halpern 2020-04-02 21:58:59 -04:00 committed by GitHub
parent 19da53450e
commit c1cf1df7a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 8 deletions

View file

@ -85,9 +85,9 @@ class NotifyMailer < ApplicationMailer
@membership = membership
@inviter = inviter
subject = if @membership.role == "mod"
"You are invited to Channel #{@membership.chat_channel.channel_name} as moderator."
"You are invited to the #{@membership.chat_channel.channel_name} channel as moderator."
else
"You are invited to Channel #{@membership.chat_channel.channel_name} by #{@inviter.name}."
"You are invited to the #{@membership.chat_channel.channel_name} channel."
end
mail(to: @membership.user.email, subject: subject)
end

View file

@ -78,7 +78,7 @@ class ChatChannel < ApplicationRecord
channel.status = "active"
channel.save
else
create(
channel = create(
channel_type: channel_type,
channel_name: contrived_name,
slug: slug,
@ -86,6 +86,7 @@ class ChatChannel < ApplicationRecord
status: "active",
)
end
channel
end
end

View file

@ -4,11 +4,15 @@
<td style="padding:4%;">
<% if @membership.role == "mod" %>
<h2 style="font-size: 25px; text-align: center;">
You have been invited to be a Moderator of a connect group on <%= ApplicationConfig["COMMUNITY_NAME"] %>.
You have been invited to be a Moderator of a Connect group on <%= ApplicationConfig["COMMUNITY_NAME"] %>.
</h2>
<% elsif @inviter %>
<h2 style="font-size: 25px; text-align: center;">
<%= link_to(@inviter.name, ApplicationController.helpers.user_url(@inviter)) %> sent you an invitation to join a Connect group on <%= ApplicationConfig["COMMUNITY_NAME"] %>.
</h2>
<% else %>
<h2 style="font-size: 25px; text-align: center;">
<%= link_to(@inviter.name, ApplicationController.helpers.user_url(@inviter)) %> sent you an invitation to join a connect group on <%= ApplicationConfig["COMMUNITY_NAME"] %>.
You have been invited to a Connect group on <%= ApplicationConfig["COMMUNITY_NAME"] %>.
</h2>
<% end %>
<table>
@ -32,7 +36,9 @@
<br>
<br>
<div>
<p style="background:#3c7dc1;color:white;padding:5px 14px;border-radius:3px;text-decoration:none; margin-top:4px;"><%= link_to("Check Invitation", ApplicationController.helpers.app_url("connect?ref=group_invite")) %> </p>
<p style="background:#3c7dc1;color:white;padding:5px 14px;border-radius:3px;text-decoration:none; margin-top:4px;">
<%= link_to("Check Invitation", ApplicationController.helpers.app_url("connect?ref=group_invite"), style: "color: white;font-size:1.4em;font-weight: bold;text-decoration: none;padding: 15px 0px; display: block;") %>
</p>
</div>
</td>
</tr>

View file

@ -489,8 +489,8 @@ RSpec.describe NotifyMailer, type: :mailer do
let(:member_email) { described_class.channel_invite_email(regular_membership, user) }
it "renders proper subject" do
expect(moderator_email.subject).to eq("You are invited to Channel #{moderator_membership.chat_channel.channel_name} as moderator.")
expect(member_email.subject).to eq("You are invited to Channel #{regular_membership.chat_channel.channel_name} by #{user.name}.")
expect(moderator_email.subject).to eq("You are invited to the #{moderator_membership.chat_channel.channel_name} channel as moderator.")
expect(member_email.subject).to eq("You are invited to the #{regular_membership.chat_channel.channel_name} channel.")
end
it "renders proper sender" do

View file

@ -32,6 +32,12 @@ class NotifyMailerPreview < ActionMailer::Preview
NotifyMailer.new_badge_email(badge_achievement)
end
def channel_invite_email
user = User.first
membership = ChatChannelMembership.last
NotifyMailer.channel_invite_email(membership, user)
end
def tag_moderator_confirmation_email
NotifyMailer.tag_moderator_confirmation_email(User.first, "discuss")
end