[deploy] Optimization:Create message JSON once when Notifying Users (#9492)

This commit is contained in:
Molly Struve 2020-07-24 10:56:05 -05:00 committed by GitHub
parent 330009995d
commit cd22f395d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -107,8 +107,9 @@ class MessagesController < ApplicationController
def notify_users(user_ids, type)
return unless user_ids
message_json = create_pusher_payload(@message, @temp_message_id)
user_ids.each do |id|
message_json = create_pusher_payload(@message, @temp_message_id)
if type == "mention"
Pusher.trigger("private-message-notifications-#{id}", "mentioned", message_json)
else