diff --git a/app/messages/new_wiki_page.email.erb b/app/messages/new_wiki_page.email.erb deleted file mode 100644 index ff4f8966162..00000000000 --- a/app/messages/new_wiki_page.email.erb +++ /dev/null @@ -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 %> diff --git a/app/messages/new_wiki_page.facebook.erb b/app/messages/new_wiki_page.facebook.erb deleted file mode 100644 index 81e38d24ad1..00000000000 --- a/app/messages/new_wiki_page.facebook.erb +++ /dev/null @@ -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 %> - -<%= asset.title %> diff --git a/app/messages/new_wiki_page.sms.erb b/app/messages/new_wiki_page.sms.erb deleted file mode 100644 index aa4a6cc4df3..00000000000 --- a/app/messages/new_wiki_page.sms.erb +++ /dev/null @@ -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) %> \ No newline at end of file diff --git a/app/messages/new_wiki_page.summary.erb b/app/messages/new_wiki_page.summary.erb deleted file mode 100644 index fedf7aac3db..00000000000 --- a/app/messages/new_wiki_page.summary.erb +++ /dev/null @@ -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) %> diff --git a/app/messages/new_wiki_page.twitter.erb b/app/messages/new_wiki_page.twitter.erb deleted file mode 100644 index 0ec74edc663..00000000000 --- a/app/messages/new_wiki_page.twitter.erb +++ /dev/null @@ -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) %> diff --git a/app/models/notification.rb b/app/models/notification.rb index 64056a4d4fa..27ab2f359a1 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -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' diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index dd099139ef6..a6c77c26d19 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -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 diff --git a/lib/tasks/db_load_data.rake b/lib/tasks/db_load_data.rake index d5655870c31..5ee1c83012d 100644 --- a/lib/tasks/db_load_data.rake +++ b/lib/tasks/db_load_data.rake @@ -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 diff --git a/spec/messages/new_wiki_page.email.erb_spec.rb b/spec/messages/new_wiki_page.email.erb_spec.rb deleted file mode 100644 index b429e4efdb4..00000000000 --- a/spec/messages/new_wiki_page.email.erb_spec.rb +++ /dev/null @@ -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 . -# - -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 diff --git a/spec/messages/new_wiki_page.facebook.erb_spec.rb b/spec/messages/new_wiki_page.facebook.erb_spec.rb deleted file mode 100644 index d6af827e067..00000000000 --- a/spec/messages/new_wiki_page.facebook.erb_spec.rb +++ /dev/null @@ -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 . -# - -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 diff --git a/spec/messages/new_wiki_page.sms.erb_spec.rb b/spec/messages/new_wiki_page.sms.erb_spec.rb deleted file mode 100644 index b4ad56f72fb..00000000000 --- a/spec/messages/new_wiki_page.sms.erb_spec.rb +++ /dev/null @@ -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 . -# - -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 diff --git a/spec/messages/new_wiki_page.summary.erb_spec.rb b/spec/messages/new_wiki_page.summary.erb_spec.rb deleted file mode 100644 index 548397d4f4c..00000000000 --- a/spec/messages/new_wiki_page.summary.erb_spec.rb +++ /dev/null @@ -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 . -# - -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 diff --git a/spec/models/wiki_page_spec.rb b/spec/models/wiki_page_spec.rb index df4b58d5c08..c25f783210f 100644 --- a/spec/models/wiki_page_spec.rb +++ b/spec/models/wiki_page_spec.rb @@ -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")