* VRFS-997 - mix complete notification
This commit is contained in:
parent
59c1b02e1c
commit
b8829b417a
|
|
@ -327,9 +327,10 @@ message RecordingEnded {
|
|||
|
||||
message RecordingMasterMixComplete {
|
||||
optional string recording_id = 1;
|
||||
optional string msg = 2;
|
||||
optional string notification_id = 3;
|
||||
optional string created_at = 4;
|
||||
optional string band_id = 2;
|
||||
optional string msg = 3;
|
||||
optional string notification_id = 4;
|
||||
optional string created_at = 5;
|
||||
}
|
||||
|
||||
message DownloadAvailable {
|
||||
|
|
|
|||
|
|
@ -473,7 +473,20 @@ module JamRuby
|
|||
)
|
||||
end
|
||||
|
||||
def recording_master_mix_complete
|
||||
def recording_master_mix_complete(receiver_id, recording_id, band_id, msg, notification_id, created_at)
|
||||
recording_master_mix_complete = Jampb::RecordingMasterMixComplete.new(
|
||||
:band_invitation_id => invitation_id,
|
||||
:photo_url => photo_url,
|
||||
:msg => msg,
|
||||
:notification_id => notification_id,
|
||||
:created_at => created_at
|
||||
)
|
||||
|
||||
return Jampb::ClientMessage.new(
|
||||
:type => ClientMessage::Type::RECORDING_MASTER_MIX_COMPLETE,
|
||||
:route_to => USER_TARGET_PREFIX + receiver_id,
|
||||
:recording_master_mix_complete => recording_master_mix_complete
|
||||
)
|
||||
end
|
||||
|
||||
# create a band invitation message
|
||||
|
|
|
|||
|
|
@ -56,9 +56,7 @@ module JamRuby
|
|||
self.md5 = md5
|
||||
self.completed = true
|
||||
if save
|
||||
recording.users.each do |user|
|
||||
Notification.send_download_available(user.id)
|
||||
end
|
||||
Notification.send_recording_master_mix_complete(recording)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ module JamRuby
|
|||
belongs_to :session, :class_name => "JamRuby::MusicSession", :foreign_key => "session_id"
|
||||
belongs_to :recording, :class_name => "JamRuby::Recording", :foreign_key => "recording_id"
|
||||
|
||||
validates :target_user, :presence => true
|
||||
|
||||
def index(user_id)
|
||||
Notification.where(:target_user_id => user_id).limit(50)
|
||||
end
|
||||
|
|
@ -658,6 +660,23 @@ module JamRuby
|
|||
end
|
||||
|
||||
def send_recording_master_mix_complete(recording)
|
||||
|
||||
# only people who get told about mixes are folks who claimed it... not everyone in the session
|
||||
recording.claimed_recordings.each do |claimed_recording|
|
||||
|
||||
notification = Notification.new
|
||||
notification.band_id = recording.band.id if recording.band
|
||||
notification.recording_id = recording.id
|
||||
notification.target_user_id = claimed_recording.user_id
|
||||
notification.description = NotificationTypes::RECORDING_MASTER_MIX_COMPLETE
|
||||
notification.save
|
||||
|
||||
notification_msg = format_msg(notification.description, nil, recording.band)
|
||||
|
||||
msg = @@message_factory.recording_master_mix_complete(claimed_recording.user_id, recording.id, notification.band_id, notification_msg, notification.id, notification.created_at.to_s)
|
||||
|
||||
@@mq_router.publish_to_user(claimed_recording.user_id, msg)
|
||||
end
|
||||
end
|
||||
|
||||
def send_band_invitation(band, band_invitation, sender, receiver)
|
||||
|
|
|
|||
|
|
@ -211,6 +211,7 @@
|
|||
|
||||
else if (type === context.JK.MessageType.RECORDING_MASTER_MIX_COMPLETE) {
|
||||
$notification.find('#div-actions').hide();
|
||||
context.jamClient.OnDownloadAvailable(); // poke backend, letting it know a download is available
|
||||
}
|
||||
|
||||
else if (type === context.JK.MessageType.BAND_INVITATION) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue