remove unused assignment_unmuted notification
closes TALLY-653 flag = none With Post Policies, this notification is no longer sent. If the build passes with this commit, it is likely safe to merge. But a sanity check would be below. test plan: 1. Have a student with notifications enabled 2. Mute an assignment in SRGB 3. Assign the student to the muted assignment 4. Unmute the assignment in SRGB 5. Verify the world is not on fire Change-Id: Ie1bc03b0ac8f0279f2b6ea91a6ce1a65963fc43c Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/228993 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Gary Mei <gmei@instructure.com> Reviewed-by: Nick Pitrak <npitrak@instructure.com> QA-Review: Robin Kuss <rkuss@instructure.com> Product-Review: Jonathan Fenton <jfenton@instructure.com>
This commit is contained in:
parent
98fe70182f
commit
fd1a4097bb
|
@ -1,15 +0,0 @@
|
|||
<% define_content :link do %>
|
||||
<%= polymorphic_url([asset.context, asset]) %>
|
||||
<% end %>
|
||||
|
||||
<% define_content :subject do %>
|
||||
<%= t :subject, "Assignment Unmuted: %{title}, %{course}", :title => asset.title, :course => asset.context.name %>
|
||||
<% end %>
|
||||
|
||||
<%= t :body, <<-BODY, :title => asset.title, :course => asset.context.name, :url => content(:link)
|
||||
Your instructor has released grade changes and new comments for %{title}. These changes are now viewable.
|
||||
|
||||
You can view it here:
|
||||
%{url}
|
||||
BODY
|
||||
%>
|
|
@ -1,15 +0,0 @@
|
|||
<% define_content :link do %>
|
||||
<%= polymorphic_url([asset.context, asset]) %>
|
||||
<% end %>
|
||||
|
||||
<% define_content :subject do %>
|
||||
<%= t :subject, "Assignment Unmuted: %{title}, %{course}", :title => asset.title, :course => asset.context.name %>
|
||||
<% end %>
|
||||
|
||||
<% define_content :footer_link do %>
|
||||
<a href="<%= content(:link) %>">
|
||||
<%= t :link, "You can view it here" %>
|
||||
</a>
|
||||
<% end %>
|
||||
|
||||
<p><%= t :body, "Your instructor has released grade changes and new comments for %{title}. These changes are now viewable.", :title => asset.title %></p>
|
|
@ -1,6 +0,0 @@
|
|||
<%= t :body, <<-BODY, :title => asset.title, :course => asset.context.name, :website => HostUrl.context_host(asset.context)
|
||||
Your instructor has released grades and comments for %{title}, %{course}.
|
||||
|
||||
More info at %{website}
|
||||
BODY
|
||||
%>
|
|
@ -1,7 +0,0 @@
|
|||
<% define_content :link do %>
|
||||
<%= polymorphic_url([asset.context, asset]) %>
|
||||
<% end %>
|
||||
|
||||
<% define_content :subject do %>
|
||||
<%= t :subject, "Grades and comments released for: %{title}, %{course}", :title => asset.title, :course => asset.context.name %>
|
||||
<% end %>
|
|
@ -126,8 +126,6 @@
|
|||
notifications:
|
||||
- name: Assignment Graded
|
||||
delay_for: <%= 15*60 %>
|
||||
- name: Assignment Unmuted
|
||||
delay_for: 0
|
||||
- name: Submission Graded
|
||||
delay_for: <%= 60*60 %>
|
||||
- name: Submission Grade Changed
|
||||
|
|
|
@ -1123,16 +1123,6 @@ class Assignment < ActiveRecord::Base
|
|||
assignment.overridden_for(user, skip_clone: true)
|
||||
}
|
||||
|
||||
p.dispatch :assignment_unmuted
|
||||
p.to { |assignment|
|
||||
BroadcastPolicies::AssignmentParticipants.new(assignment).to
|
||||
}
|
||||
p.whenever { |assignment|
|
||||
BroadcastPolicies::AssignmentPolicy.new(assignment).
|
||||
should_dispatch_assignment_unmuted?
|
||||
}
|
||||
p.data { course_broadcast_data }
|
||||
|
||||
p.dispatch :submissions_posted
|
||||
p.to { |assignment|
|
||||
assignment.course.participating_instructors
|
||||
|
@ -3391,7 +3381,6 @@ class Assignment < ActiveRecord::Base
|
|||
|
||||
previously_unposted_submissions.each do |submission|
|
||||
submission.grade_posting_in_progress = true
|
||||
# Need to broadcast assignment_unmuted here.
|
||||
submission.broadcast_notifications
|
||||
submission.grade_posting_in_progress = false
|
||||
end
|
||||
|
|
|
@ -48,13 +48,6 @@ module BroadcastPolicies
|
|||
(assignment.saved_change_to_workflow_state? && assignment.published?)
|
||||
end
|
||||
|
||||
def should_dispatch_assignment_unmuted?
|
||||
# This is handled by individual submissions in the Post Policies era.
|
||||
return false if assignment.context.post_policies_enabled?
|
||||
context_sendable? &&
|
||||
assignment.recently_unmuted
|
||||
end
|
||||
|
||||
def should_dispatch_submissions_posted?
|
||||
return false unless assignment.context.post_policies_enabled?
|
||||
context_sendable? && assignment.posting_params_for_notifications.present?
|
||||
|
|
|
@ -73,8 +73,6 @@ module BroadcastPolicies
|
|||
end
|
||||
|
||||
def should_dispatch_submission_posted?
|
||||
# When Post Policies aren't enabled, the assignment handles notifications
|
||||
# via the Assignment Unmuted notification.
|
||||
return false unless assignment.course.post_policies_enabled? &&
|
||||
submission.grade_posting_in_progress &&
|
||||
context_sendable?
|
||||
|
|
|
@ -487,7 +487,6 @@ EOS
|
|||
Includes:
|
||||
|
||||
* Assignment/submission grade entered/changed
|
||||
* Un-muted assignment grade
|
||||
* Grade weight changed
|
||||
EOS
|
||||
when 'Late Grading'
|
||||
|
|
|
@ -16,26 +16,6 @@
|
|||
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
module Mutable
|
||||
|
||||
attr_accessor :recently_unmuted
|
||||
|
||||
def self.included(base)
|
||||
base.extend(ClassMethods)
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
def declare_mutable_broadcast_policy(options)
|
||||
policy = options[:policy]
|
||||
participants = options[:participants]
|
||||
|
||||
policy.dispatch :assignment_unmuted
|
||||
policy.to { participants }
|
||||
policy.whenever do |record|
|
||||
@recently_unmuted
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def mute!
|
||||
return if muted?
|
||||
self.update_attribute(:muted, true)
|
||||
|
@ -48,18 +28,11 @@ module Mutable
|
|||
def unmute!
|
||||
return unless muted?
|
||||
self.update_attribute(:muted, false)
|
||||
broadcast_unmute_event
|
||||
post_submissions if respond_to?(:post_submissions)
|
||||
ensure_post_policy(post_manually: false) if respond_to?(:ensure_post_policy)
|
||||
true
|
||||
end
|
||||
|
||||
def broadcast_unmute_event
|
||||
@recently_unmuted = true
|
||||
self.save!
|
||||
@recently_unmuted = false
|
||||
end
|
||||
|
||||
protected
|
||||
def clear_sent_messages
|
||||
self.clear_broadcast_messages if self.respond_to? :clear_broadcast_messages
|
||||
|
|
|
@ -60,17 +60,5 @@ describe Mutable do
|
|||
expect(@mutable).to receive(:update_attribute).never
|
||||
@mutable.unmute!
|
||||
end
|
||||
|
||||
it "broadcasts unmute event if currently muted" do
|
||||
expect(@mutable).to receive(:muted?).and_return(true)
|
||||
expect(@mutable).to receive(:broadcast_unmute_event).once
|
||||
@mutable.unmute!
|
||||
end
|
||||
|
||||
it "skips unmute event if not muted" do
|
||||
expect(@mutable).to receive(:muted?).and_return(false)
|
||||
expect(@mutable).to receive(:broadcast_unmute_event).never
|
||||
@mutable.unmute!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5107,43 +5107,6 @@ describe Assignment do
|
|||
end
|
||||
end
|
||||
|
||||
context "assignment unmuted" do
|
||||
let(:assignment) { @course.assignments.create! }
|
||||
|
||||
before :once do
|
||||
@assignment_unmuted_notification = Notification.create(name: "Assignment Unmuted")
|
||||
@student.update!(email: "fakeemail@example.com")
|
||||
@student.email_channel.update!(workflow_state: :active)
|
||||
end
|
||||
|
||||
it "should create a message when an assignment is unmuted" do
|
||||
assignment.mute!
|
||||
|
||||
expect {
|
||||
assignment.unmute!
|
||||
}.to change {
|
||||
DelayedMessage.where(
|
||||
communication_channel: @student.email_channel,
|
||||
notification: @assignment_unmuted_notification
|
||||
).count
|
||||
}.by(1)
|
||||
end
|
||||
|
||||
it "should not create a message in an unpublished course" do
|
||||
@course.update!(workflow_state: "created")
|
||||
assignment.mute!
|
||||
|
||||
expect {
|
||||
assignment.unmute!
|
||||
}.not_to change {
|
||||
DelayedMessage.where(
|
||||
communication_channel: @student.email_channel,
|
||||
notification: @assignment_unmuted_notification
|
||||
).count
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
context "varied due date notifications" do
|
||||
before :once do
|
||||
@teacher.communication_channels.create(:path => "teacher@instructure.com").confirm!
|
||||
|
|
|
@ -117,30 +117,6 @@ module BroadcastPolicies
|
|||
specify { wont_send_when { allow(assignment).to receive(:saved_change_to_points_possible?).and_return false } }
|
||||
end
|
||||
|
||||
describe '#should_dispatch_assignment_unmuted?' do
|
||||
before do
|
||||
allow(assignment).to receive(:recently_unmuted).and_return true
|
||||
end
|
||||
|
||||
it 'is true when the dependent inputs are true' do
|
||||
expect(policy.should_dispatch_assignment_unmuted?).to be_truthy
|
||||
end
|
||||
|
||||
it "returns false when post policies are enabled" do
|
||||
allow(context).to receive(:post_policies_enabled?).and_return true
|
||||
expect(policy.should_dispatch_assignment_unmuted?).to be false
|
||||
end
|
||||
|
||||
def wont_send_when
|
||||
yield
|
||||
expect(policy.should_dispatch_assignment_unmuted?).to be_falsey
|
||||
end
|
||||
|
||||
specify { wont_send_when { allow(context).to receive(:available?).and_return false } }
|
||||
specify { wont_send_when { allow(assignment).to receive(:recently_unmuted).and_return false } }
|
||||
|
||||
end
|
||||
|
||||
describe "#should_dispatch_submissions_posted" do
|
||||
let(:posting_params) { { graded_only: false } }
|
||||
|
||||
|
|
Loading…
Reference in New Issue