remove the new wiki page notification

closes #4692

This email was sent as soon as the record was created, which wasn't at
all helpful since at that point it has no content. It also caused issues
with teachers who wanted to create hidden wiki pages, since it is sent
before the teacher has a chance to hide the page.

updated wiki page notifications will still be sent out.

Change-Id: Ie6762eafd67d683dbf942a5fb5c443dd1b2288e6
Reviewed-on: https://gerrit.instructure.com/6786
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Brian Palmer 2011-11-08 09:17:32 -07:00
parent c0b56aa569
commit ad8fcba2e6
13 changed files with 2 additions and 236 deletions

View File

@ -1,18 +0,0 @@
<% namespace = asset.find_namespace_for_user(user) %>
<% define_content :link do %>
<% namespace = asset.find_namespace_for_user(user) %>http://<%= HostUrl.context_host(namespace.context) %>/<%= namespace.context.class.to_s.downcase.pluralize %>/<%= namespace.context_id %>/wiki/<%= namespace.namespace + ":" if !namespace.default? %><%= asset.url %>
<% end %>
<% define_content :subject do %>
<%= t :subject, "New Wiki Page - %{page_title}: %{course_or_group}", :page_title => asset.title, :course_or_group => asset.find_namespace_for_user(user).context.name rescue "" %>
<% end %>
<%= t :body, "A new page has been added to the wiki for %{course_or_group} that may make your life easier.", :course_or_group => asset.context.name %>
<%= asset.title %>
<%= strip_and_truncate(asset.body, :max_length => 200) %>
<%= t :details, "You can review it here:" %>
<%= content :link %>

View File

@ -1,8 +0,0 @@
<% namespace = asset.find_namespace_for_user(user) %>
<% define_content :link do %>
<% namespace = asset.find_namespace_for_user(user) %>http://<%= HostUrl.context_host(namespace.context) %>/<%= namespace.context.class.to_s.downcase.pluralize %>/<%= namespace.context_id %>/wiki/<%= namespace.namespace + ":" if !namespace.default? %><%= asset.url %>
<% end %>
<%= t :body, "A new page has been added to the wiki for %{course_or_group} that may make your life easier.", :course_or_group => asset.context.name %>
<b><a href="<%= content :link %>"><%= asset.title %></a></b>

View File

@ -1,6 +0,0 @@
<%= t :body, "New wiki page for %{course_or_group}:", :course_or_group => asset.find_namespace_for_user(user).context.name rescue "" %>
<%= asset.title.titleize %>
<%= strip_and_truncate(asset.body, :max_length => 50) %>
<%= t :details, "More info at %{url}", :url => HostUrl.context_host(asset.find_namespace_for_user(user).context) %>

View File

@ -1,10 +0,0 @@
<% wiki_namespace = asset.find_namespace_for_user(user) %>
<% define_content :link do %>
http://<%= HostUrl.context_host(wiki_namespace.context) %>/<%= wiki_namespace.context.class.to_s.downcase.pluralize %>/<%= wiki_namespace.context_id %>/wiki/<%= wiki_namespace.namespace + ":" if !wiki_namespace.default? %><%= asset.url %>
<% end %>
<% define_content :subject do %>
<%= t :subject, "New Wiki Page - %{page_title}: %{course_or_group}", :page_title => asset.title, :course_or_group => wiki_namespace.context.name rescue "" %>
<% end %>
<%= strip_and_truncate(asset.body, :max_length => 200) %>

View File

@ -1,5 +0,0 @@
<% define_content :link do %>
<% namespace = asset.find_namespace_for_user(user) %>http://<%= HostUrl.context_host(namespace.context) %>/<%= namespace.context.class.to_s.downcase.pluralize %>/<%= namespace.context_id %>/wiki/<%= namespace.namespace + ":" if !namespace.default? %><%= asset.url %>
<% end %>
<%= t :body, "Canvas Alert - New Page: %{page_title}, %{course_or_group}", :page_title => asset.title, :course_or_group => asset.find_namespace_for_user(user).context.name rescue "" %>.
<%= strip_and_truncate(asset.body, :max_length => 50) %>

View File

@ -476,7 +476,6 @@ class Notification < ActiveRecord::Base
t 'names.new_student_organized_group', 'New Student Organized Group'
t 'names.new_teacher_registration', 'New Teacher Registration'
t 'names.new_user', 'New User'
t 'names.new_wiki_page', 'New Wiki Page'
t 'names.pseudonym_registration', 'Pseudonym Registration'
t 'names.report_generated', 'Report Generated'
t 'names.report_generation_failed', 'Report Generation Failed'

View File

@ -274,15 +274,8 @@ class WikiPage < ActiveRecord::Base
context_roles = namespace.context.default_wiki_editing_roles rescue nil
(self.editing_roles || context_roles || default_roles).split(",")
end
set_broadcast_policy do |p|
p.dispatch :new_wiki_page
p.to { participants }
p.whenever { |record|
record.active? &&
record.just_created
}
p.dispatch :updated_wiki_page
p.to { participants }
p.whenever { |record|
@ -294,9 +287,8 @@ class WikiPage < ActiveRecord::Base
record.changed_state(:active)
))
}
end
def context(user=nil)
(@context_for_user ||= {})[user] ||= (find_namespace_for_user(user).context rescue nil)
end

View File

@ -960,30 +960,6 @@ namespace :db do
Your grade for <%= asset.assignment.title %>, <%= asset.assignment.context.name %> just changed.
}
create_notification 'WikiPage', 'Course Content', 0,
'<%ns=asset.find_namespace_for_user(user) %>http://<%= HostUrl.context_host(ns.context) %>/<%= ns.context.class.to_s.downcase.pluralize %>/<%= ns.context_id %>/wiki/<%= ns.namespace + ":" if !ns.default? %><%= asset.url %>', %{
New Wiki Page
New Wiki Page - <%= asset.title.titleize %>: <%= asset.find_namespace_for_user(user).context.name rescue "" %>
<% namespace = asset.find_namespace_for_user(user) %>
A new page has been added to the wiki for <%= namespace.context.name %> that may make your life easier.
<%= asset.title.titleize %>
<%= strip_and_truncate(asset.body, :max_length => 200) %>
You can review it here:
<%= main_link %>
}, %{
New wiki page for <%= asset.find_namespace_for_user(user).context.name rescue "" %>:
<%= asset.title.titleize %>
<%= strip_and_truncate(asset.body, :max_length => 200) %>
}
create_notification 'WikiPage', 'Course Content', 15*60,
'<%ns=asset.find_namespace_for_user(user)%>http://<%= HostUrl.context_host(ns.context) %>/<%= ns.context.class.to_s.downcase.pluralize %>/<%= ns.context_id %>/wiki/<%= ns.namespace + ":" if !ns.default? %><%= asset.url %>', %{
Updated Wiki Page

View File

@ -1,36 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'new_wiki_page.email' do
it "should render" do
wiki_page_model
@object = @page
@object.reload
@object.wiki.should_not be_nil
@object.wiki_with_participants.should_not be_nil
@object.wiki_with_participants.wiki_namespaces.should_not be_empty
@object.wiki_with_participants.wiki_namespaces.first.context.participants.should be_include(@user)
@object.wiki.wiki_namespaces.should_not be_empty
@object.wiki.wiki_namespaces.count.should == 1
@object.find_namespace_for_user(@user).should_not be_nil
generate_message(:new_wiki_page, :email, @object, :user => @user)
end
end

View File

@ -1,35 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'new_wiki_page.facebook' do
it "should render" do
wiki_page_model
@object = @page
@object.reload
@object.wiki.should_not be_nil
@object.wiki_with_participants.should_not be_nil
@object.wiki_with_participants.wiki_namespaces.should_not be_empty
@object.wiki_with_participants.wiki_namespaces.first.context.participants.should be_include(@user)
@object.wiki.wiki_namespaces.should_not be_empty
@object.find_namespace_for_user(@user).should_not be_nil
generate_message(:new_wiki_page, :facebook, @object, :user => @user)
end
end

View File

@ -1,35 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'new_wiki_page.sms' do
it "should render" do
wiki_page_model
@object = @page
@object.reload
@object.wiki.should_not be_nil
@object.wiki_with_participants.should_not be_nil
@object.wiki_with_participants.wiki_namespaces.should_not be_empty
@object.wiki_with_participants.wiki_namespaces.first.context.participants.should be_include(@user)
@object.wiki.wiki_namespaces.should_not be_empty
@object.find_namespace_for_user(@user).should_not be_nil
generate_message(:new_wiki_page, :sms, @object, :user => @user)
end
end

View File

@ -1,36 +0,0 @@
#
# Copyright (C) 2011 Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require File.expand_path(File.dirname(__FILE__) + '/messages_helper')
describe 'new_wiki_page.summary' do
it "should render" do
wiki_page_model
@object = @page
@object.reload
@object.wiki.should_not be_nil
@object.wiki_with_participants.should_not be_nil
@object.wiki_with_participants.wiki_namespaces.should_not be_empty
@object.wiki_with_participants.wiki_namespaces.first.context.participants.should be_include(@user)
@object.wiki.wiki_namespaces.should_not be_empty
@object.find_namespace_for_user(@user).should_not be_nil
@object.find_namespace_for_user(@user).context.should_not be_nil
generate_message(:new_wiki_page, :summary, @object, :user => @user)
end
end

View File

@ -19,18 +19,6 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper.rb')
describe WikiPage do
# it "should send page created notifications" do
# course_with_teacher(:active_all => true)
# Notification.create(:name => "New Wiki Page")
# p = @course.wiki.wiki_pages.create(:title => "some page")
# p.messages_sent.should_not be_nil
# p.messages_sent.should_not be_empty
# p.messages_sent["New Wiki Page"].should_not be_nil
# p.messages_sent["New Wiki Page"].should_not be_empty
# p.messages_sent["New Wiki Page"][0].user.should eql(@user)
# end
it "should send page updated notifications" do
course_with_teacher(:active_all => true)
n = Notification.create(:name => "Updated Wiki Page", :category => "TestImmediately")