conversation message notifications prefs

Change-Id: Ida26bebdda7991afa132cbacb3e0eef283ba2020
Reviewed-on: https://gerrit.instructure.com/5163
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
This commit is contained in:
Jacob Fugal 2011-08-19 15:22:32 -06:00 committed by Zach Wily
parent 081668c4f6
commit b543701f17
3 changed files with 32 additions and 1 deletions

View File

@ -483,7 +483,7 @@ class Notification < ActiveRecord::Base
t 'names.rubric_assessment_submission_reminder', 'Rubric Assessment Submission Reminder'
t 'names.rubric_association_created', 'Rubric Association Created'
t 'names.conversation_message', 'Conversation Message'
t 'names.added_to_conversation', 'Added to Conversation'
t 'names.added_to_conversation', 'Added To Conversation'
t 'names.submission_comment', 'Submission Comment'
t 'names.submission_comment_for_teacher', 'Submission Comment For Teacher'
t 'names.submission_grade_changed', 'Submission Grade Changed'
@ -550,6 +550,10 @@ class Notification < ActiveRecord::Base
t(:message_description, "For new email messages")
when 'Student Message'
t(:student_message_description, "For private messages from students")
when 'Conversation Message'
t(:conversation_message_description, "For new conversation messages")
when 'Added To Conversation'
t(:added_to_conversation_description, "For conversations to which you're added")
else
t(:missing_description_description, "For %{category} alerts", :category => category)
end

View File

@ -0,0 +1,25 @@
class ContextToConversationNotificationPreferences < ActiveRecord::Migration
def self.up
if context_message = Notification.find_by_category("Context Message")
if conversation_message = Notification.find_by_category("Conversation Message")
execute <<-SQL
INSERT INTO notification_policies
(notification_id, user_id, communication_channel_id, broadcast, frequency)
SELECT #{conversation_message.id}, user_id, communication_channel_id, broadcast, frequency
FROM notification_policies WHERE notification_id=#{context_message.id};
SQL
end
if added_to_conversation = Notification.find_by_category("Added To Conversation")
execute <<-SQL
INSERT INTO notification_policies
(notification_id, user_id, communication_channel_id, broadcast, frequency)
SELECT #{added_to_conversation.id}, user_id, communication_channel_id, broadcast, frequency
FROM notification_policies WHERE notification_id=#{context_message.id}
SQL
end
end
end
def self.down
end
end

View File

@ -727,6 +727,8 @@ namespace :db do
<%= strip_and_truncate(asset.body, :max_length => 50) %>
}
create_notification 'AddedToConversation', 'Added To Conversation', 0, 'http://<%= HostUrl.default_host %>', ""
create_notification 'GroupMembership', 'Membership Update', 0,
'http://<%= HostUrl.context_host(asset.group.context) %>/<%= asset.group.context.class.to_s.downcase.pluralize %>/<%= asset.context_id %>/groups', %{
New Context Group Membership