account for group announcements in new message

flag=none
fixes VICE-3412

test plan:
- specs pass

OR
- create a new group announcement
- as an admin visit /users/:id_of_someone_in_group/messages
- go to html tab of the new announcement messae
- verify the messaging at the bottom says Group instead
of Course

Change-Id: Ibb80ddc2097291b0e8aee5b0c1adf5ce64d3c67c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/315513
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com>
Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
QA-Review: Jason Gillett <jason.gillett@instructure.com>
This commit is contained in:
Caleb Guanzon 2023-04-10 09:45:52 -06:00
parent 87eae6312e
commit f0bb4380bb
2 changed files with 24 additions and 4 deletions

View File

@ -31,5 +31,9 @@
<% end %>
<% if !asset.locked? %>
<%= t :announcement_info, "Replies to this email will be posted as a reply to the announcement, which will be seen by everyone in the course." %>
<% if asset.context.is_a? Course %>
<%= t :announcement_info_course, "Replies to this email will be posted as a reply to the announcement, which will be seen by everyone in the course." %>
<% else %>
<%= t :announcement_info_group, "Replies to this email will be posted as a reply to the announcement, which will be seen by everyone in the group." %>
<% end%>
<% end %>

View File

@ -33,12 +33,12 @@ describe "new_announcement" do
context ".email" do
let(:path_type) { :email }
it "renders" do
it "renders for course" do
generate_message(notification_name, path_type, asset)
expect(@message.subject).to eq "value for title: value for name"
expect(@message.url).to match(%r{/courses/\d+/announcements/\d+})
expect(@message.body).to match(%r{/courses/\d+/announcements/\d+})
expect(@message.html_body).to include "Replies to this email will be posted as a reply to the announcement,"
expect(@message.html_body).to include "Replies to this email will be posted as a reply to the announcement, which will be seen by everyone in the course."
end
it "does not show announcement reply helper if announcement is locked" do
@ -49,7 +49,23 @@ describe "new_announcement" do
expect(@message.subject).to eq "value for title: value for name"
expect(@message.url).to match(%r{/courses/\d+/announcements/\d+})
expect(@message.body).to match(%r{/courses/\d+/announcements/\d+})
expect(@message.html_body).not_to include "Replies to this email will be posted as a reply to the announcement,"
expect(@message.html_body).not_to include "Replies to this email will be posted as a reply to the announcement, which will be seen by everyone in the course."
end
it "renders for group" do
@course.group_categories.create!(name: "My Group Category")
teacher_in_course
group = @course.groups.create!(name: "My Group", group_category: @course.group_categories.first)
group_announcement = group.announcements.create!(
title: "Group Announcement",
message: "Group",
user: @teacher
)
generate_message(notification_name, path_type, group_announcement)
expect(@message.subject).to eq "Group Announcement: My Group"
expect(@message.url).to match(%r{/groups/\d+/announcements/\d+})
expect(@message.body).to match(%r{/groups/\d+/announcements/\d+})
expect(@message.html_body).to include "Replies to this email will be posted as a reply to the announcement, which will be seen by everyone in the group."
end
end