drop messages.asset_context_code, unused
closes CNVS-38367 test plan: send a message, it should work Change-Id: Ic1b99120ee0c93155a4a4475f4d1dfb3d373be37 Reviewed-on: https://gerrit.instructure.com/120424 Reviewed-by: Cody Cutrer <cody@instructure.com> Reviewed-by: Matt Smith <msmith@instructure.com> Tested-by: Jenkins Product-Review: Simon Williams <simon@instructure.com> QA-Review: Simon Williams <simon@instructure.com>
This commit is contained in:
parent
a354602ea8
commit
c5ba9dd6bd
|
@ -51,7 +51,6 @@ class Message < ActiveRecord::Base
|
|||
before_save :infer_defaults
|
||||
before_save :move_dashboard_messages
|
||||
before_save :move_messages_for_deleted_users
|
||||
before_save :set_asset_context_code
|
||||
|
||||
# Validations
|
||||
validates :body, length: {maximum: maximum_text_length}, allow_nil: true, allow_blank: true
|
||||
|
@ -144,8 +143,6 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
|
||||
# Named scopes
|
||||
scope :for_asset_context_codes, lambda { |context_codes| where(:asset_context_code => context_codes) }
|
||||
|
||||
scope :for, lambda { |context| where(:context_type => context.class.base_class.to_s, :context_id => context) }
|
||||
|
||||
scope :after, lambda { |date| where("messages.created_at>?", date) }
|
||||
|
@ -592,25 +589,6 @@ class Message < ActiveRecord::Base
|
|||
raise
|
||||
end
|
||||
|
||||
class RemoteConfigurationError < StandardError; end
|
||||
# Public: Determine the remote configuration for notification_service
|
||||
#
|
||||
# Returns string remote configuration (eventually a hash).
|
||||
def remote_configuration
|
||||
case path_type
|
||||
when "email"
|
||||
return "email.amazonaws.com"
|
||||
when "push"
|
||||
return "push.com"
|
||||
when "twitter"
|
||||
return 'twitter'
|
||||
when "sms"
|
||||
return if to =~ /^\+[0-9]+$/ ? "Twilio.com" : "email.amazonaws.com"
|
||||
else
|
||||
raise RemoteConfigurationError, "No matching path types for notification service"
|
||||
end
|
||||
end
|
||||
|
||||
# Public: Determines the message body for a notification endpoint
|
||||
#
|
||||
# Returns target notification message body
|
||||
|
@ -765,15 +743,6 @@ class Message < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
# Public: Before save, set the proper asset_context_code for the model.
|
||||
#
|
||||
# Returns an asset_context_code string or nil.
|
||||
def set_asset_context_code
|
||||
self.asset_context_code = "#{context_type.underscore}_#{context_id}"
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
|
||||
# Public: Return the message as JSON filtered to selected fields and
|
||||
# flattened appropriately.
|
||||
#
|
||||
|
|
|
@ -118,7 +118,7 @@ ActiveRecord::Base::DROPPED_COLUMNS = {
|
|||
'learning_outcome_results' => %w{comments}.freeze,
|
||||
'learning_outcome_question_results' => %w{context_code context_id context_type}.freeze,
|
||||
'lti_resource_placements' => %w(resource_handler_id).freeze,
|
||||
'messages' => %w(cc bcc notification_category).freeze,
|
||||
'messages' => %w(cc bcc notification_category asset_context_code).freeze,
|
||||
'moderated_grading_provisional_grades' => %w(position).freeze,
|
||||
'notification_policies' => %w(user_id broadcast).freeze,
|
||||
'page_views' => %w(contributed).freeze,
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
class DropAssetContextCodeFromMessages < ActiveRecord::Migration[5.0]
|
||||
tag :postdeploy
|
||||
|
||||
def change
|
||||
remove_column :messages, :asset_context_code, :string, limit: 255
|
||||
end
|
||||
end
|
|
@ -183,7 +183,6 @@ class NotificationMessageCreator
|
|||
|
||||
def dispatch_dashboard_messages(messages)
|
||||
messages.each do |message|
|
||||
message.set_asset_context_code
|
||||
message.infer_defaults
|
||||
message.create_stream_items
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue