VRFS-1891 VRFS-2022 bug fixes / test additions
This commit is contained in:
parent
af1a4596e0
commit
25e3f23dcf
|
|
@ -33,6 +33,7 @@ module JamRuby
|
|||
rs.music_session_id = '#{music_session.id}'
|
||||
}
|
||||
)
|
||||
.order('rsvp_requests.created_at DESC')
|
||||
|
||||
if options[:status] == 'approved'
|
||||
query = query.where("rrrs.chosen = true AND canceled != TRUE")
|
||||
|
|
|
|||
|
|
@ -226,14 +226,10 @@
|
|||
}
|
||||
|
||||
function cancelRsvpRequest(sessionId, rsvpRequestId, cancelAll) {
|
||||
var cancel = "yes";
|
||||
if (cancelAll) {
|
||||
cancel = "all";
|
||||
}
|
||||
return $.ajax({
|
||||
url: '/api/rsvp_requests/' + rsvpRequestId,
|
||||
type: "DELETE",
|
||||
data : JSON.stringify({"session_id": sessionId, "cancelled": cancel}),
|
||||
data : JSON.stringify({"session_id": sessionId, "cancelled": cancelAll}),
|
||||
dataType : 'json',
|
||||
contentType: 'application/json'
|
||||
});
|
||||
|
|
|
|||
|
|
@ -142,7 +142,7 @@
|
|||
var rsvpUsersHtml = '', openSlotsHtml = '', latencyHtml = '', notationFileHtml = '';
|
||||
|
||||
context._.each(session.pending_rsvp_requests, function(pending_rsvp_request) {
|
||||
if(pending_rsvp_request.user_id == context.JK.currentUserId) {
|
||||
if(pending_rsvp_request.user_id === context.JK.currentUserId) {
|
||||
pendingRsvpId = pending_rsvp_request.id;
|
||||
}
|
||||
});
|
||||
|
|
@ -185,6 +185,29 @@
|
|||
}
|
||||
}
|
||||
|
||||
// notation files
|
||||
if (session.music_notations) {
|
||||
for (i=0; i < session.music_notations.length; i++) {
|
||||
notationFileHtml += createNotationFile(session.music_notations[i]);
|
||||
}
|
||||
}
|
||||
|
||||
var sessionVals = buildSessionObject(session, notationFileHtml, rsvpUsersHtml, openSlotsHtml, latencyHtml);
|
||||
sessionVals.scheduled_start = session.pretty_scheduled_start_with_timezone;
|
||||
|
||||
var row = context.JK.fillTemplate($inactiveSessionTemplate.html(), sessionVals);
|
||||
|
||||
// initial page load
|
||||
if (!$rowToUpdate) {
|
||||
$(tbGroup).append(row);
|
||||
}
|
||||
// inline update after an RSVP submission / cancellation
|
||||
else {
|
||||
$rowToUpdate.replaceWith(row);
|
||||
}
|
||||
|
||||
var $parentRow = $('tr[data-session-id=' + session.id + ']', tbGroup);
|
||||
|
||||
var showRsvpLink = true;
|
||||
var noLinkText = '';
|
||||
|
||||
|
|
@ -194,7 +217,10 @@
|
|||
noLinkText.find('a').click(function() {
|
||||
ui.launchRsvpCancelDialog(session.id, approvedRsvpId)
|
||||
.one(EVENTS.RSVP_CANCELED, function() {
|
||||
// VRFS-1891
|
||||
rest.getSessionHistory(session.id)
|
||||
.done(function(response) {
|
||||
renderInactiveSession(response, tbGroup, $parentRow);
|
||||
});
|
||||
})
|
||||
.one(EVENTS.DIALOG_CLOSED, function() {
|
||||
$(this).unbind(EVENTS.RSVP_CANCELED);
|
||||
|
|
@ -208,7 +234,10 @@
|
|||
noLinkText.find('a').click(function() {
|
||||
ui.launchRsvpCancelDialog(session.id, pendingRsvpId)
|
||||
.one(EVENTS.RSVP_CANCELED, function() {
|
||||
// VRFS-1891
|
||||
rest.getSessionHistory(session.id)
|
||||
.done(function(response) {
|
||||
renderInactiveSession(response, tbGroup, $parentRow);
|
||||
});
|
||||
})
|
||||
.one(EVENTS.DIALOG_CLOSED, function() {
|
||||
$(this).unbind(EVENTS.RSVP_CANCELED);
|
||||
|
|
@ -224,35 +253,10 @@
|
|||
showRsvpLink = false;
|
||||
noLinkText = '<span class="text">You need an invitation to RSVP to this session.</span>';
|
||||
}
|
||||
|
||||
// notation files
|
||||
if (session.music_notations) {
|
||||
for (i=0; i < session.music_notations.length; i++) {
|
||||
notationFileHtml += createNotationFile(session.music_notations[i]);
|
||||
}
|
||||
}
|
||||
|
||||
var sessionVals = buildSessionObject(session, notationFileHtml, rsvpUsersHtml, openSlotsHtml, latencyHtml);
|
||||
sessionVals.scheduled_start = session.pretty_scheduled_start_with_timezone;
|
||||
sessionVals.rsvp_link_display_style = showRsvpLink ? "block" : "none";
|
||||
|
||||
var row = context.JK.fillTemplate($inactiveSessionTemplate.html(), sessionVals);
|
||||
|
||||
// initial page load
|
||||
if (!$rowToUpdate) {
|
||||
$(tbGroup).append(row);
|
||||
}
|
||||
// inline update after an RSVP submission / cancellation
|
||||
else {
|
||||
$rowToUpdate.replaceWith(row);
|
||||
}
|
||||
|
||||
var $parentRow = $('tr[data-session-id=' + session.id + ']', tbGroup);
|
||||
|
||||
if (showRsvpLink) {
|
||||
|
||||
$('.rsvp-msg', $parentRow).hide();
|
||||
var $parentRow = $('tr[data-session-id=' + session.id + ']', tbGroup);
|
||||
$('.rsvp-link', $parentRow).show();
|
||||
|
||||
$('.rsvp-link', $parentRow).click(function(evt) {
|
||||
ui.launchRsvpSubmitDialog(session.id)
|
||||
|
|
@ -270,6 +274,7 @@
|
|||
}
|
||||
else {
|
||||
$('.rsvp-msg', $parentRow).html(noLinkText).show();
|
||||
$('.rsvp-link', $parentRow).hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -150,11 +150,18 @@
|
|||
rest.getRsvpRequests(musicSessionId)
|
||||
.done(function(rsvps) {
|
||||
if (rsvps && rsvps.length > 0) {
|
||||
// should only be 1 RSVP for this session and user
|
||||
// the first RSVP should be the most recent (users may have many RSVPs to same session if they cancel
|
||||
// and resubmit); use its status to determine what CTA to present
|
||||
var rsvp = rsvps[0];
|
||||
if (rsvp.canceled) {
|
||||
$('.call-to-action').html('Your RSVP request to this session has been cancelled.');
|
||||
$btnAction.hide();
|
||||
$('.call-to-action').html("Tell the session organizer you'd like to play in this session");
|
||||
$btnAction.html('RSVP NOW!');
|
||||
$btnAction.click(function(e) {
|
||||
ui.launchRsvpSubmitDialog(musicSessionId)
|
||||
.one(EVENTS.RSVP_SUBMITTED, function() {
|
||||
location.reload();
|
||||
})
|
||||
});
|
||||
}
|
||||
else {
|
||||
var declined = true;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ module FeedsHelper
|
|||
end
|
||||
|
||||
def session_name(music_session, user)
|
||||
if music_session.fan_access || ( (user && user.id == music_session.creator.id) || (music_session.band && music_session.band.users.include?(user)) )
|
||||
if music_session.fan_access || music_session.unique_users.include?(user)
|
||||
music_session.name
|
||||
else
|
||||
PRIVATE_TEXT
|
||||
|
|
@ -58,7 +58,7 @@ module FeedsHelper
|
|||
end
|
||||
|
||||
def session_description(music_session, user)
|
||||
if music_session.fan_access || ( (user && user.id == music_session.creator.id) || (music_session.band && music_session.band.users.include?(user)) )
|
||||
if music_session.fan_access || music_session.unique_users.include?(user)
|
||||
music_session.description
|
||||
else
|
||||
PRIVATE_TEXT
|
||||
|
|
@ -96,7 +96,7 @@ module FeedsHelper
|
|||
|
||||
def recording_name(recording, user)
|
||||
r = recording.candidate_claimed_recording
|
||||
if r.is_public || (user && user.id == r.user.id)
|
||||
if r.is_public || recording.users.include?(user)
|
||||
r.name
|
||||
else
|
||||
PRIVATE_TEXT
|
||||
|
|
@ -105,7 +105,7 @@ module FeedsHelper
|
|||
|
||||
def recording_description(recording, user)
|
||||
r = recording.candidate_claimed_recording
|
||||
if r.is_public || (user && user.id == r.user.id)
|
||||
if r.is_public || recording.users.include?(user)
|
||||
r.description
|
||||
else
|
||||
PRIVATE_TEXT
|
||||
|
|
|
|||
|
|
@ -202,7 +202,7 @@
|
|||
</td>
|
||||
<td class="noborder rsvp-section">
|
||||
<span class="rsvp-msg" style="display:none;">You cannot RSVP to this session.</span>
|
||||
<a class="rsvp-link" style="display:{rsvp_link_display_style};">
|
||||
<a class="rsvp-link">
|
||||
<%= image_tag "content/icon_join.png", :size => "19x22" %>
|
||||
</a>
|
||||
</td>
|
||||
|
|
|
|||
|
|
@ -124,6 +124,9 @@ describe ApiFeedsController do
|
|||
get :index, { user: music_session.creator.id }
|
||||
json = JSON.parse(response.body, :symbolize_names => true)
|
||||
json[:entries].length.should == 1
|
||||
|
||||
json[:entries][0][:helpers][:name].should == music_session.music_session.name
|
||||
json[:entries][0][:helpers][:description].should == music_session.music_session.description
|
||||
end
|
||||
|
||||
it "user viewing someone else's profile" do
|
||||
|
|
@ -136,6 +139,9 @@ describe ApiFeedsController do
|
|||
get :index, { user: music_session.creator.id }
|
||||
json = JSON.parse(response.body, :symbolize_names => true)
|
||||
json[:entries].length.should == 1
|
||||
|
||||
json[:entries][0][:helpers][:name].should == "Private"
|
||||
json[:entries][0][:helpers][:description].should == "Private"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -155,6 +161,9 @@ describe ApiFeedsController do
|
|||
get :index, { band: band.id }
|
||||
json = JSON.parse(response.body, :symbolize_names => true)
|
||||
json[:entries].length.should == 1
|
||||
|
||||
json[:entries][0][:helpers][:name].should == claimed_recording1.name
|
||||
json[:entries][0][:helpers][:description].should == claimed_recording1.description
|
||||
end
|
||||
|
||||
it "user viewing someone else's band" do
|
||||
|
|
@ -172,6 +181,9 @@ describe ApiFeedsController do
|
|||
get :index, { band: band.id }
|
||||
json = JSON.parse(response.body, :symbolize_names => true)
|
||||
json[:entries].length.should == 1
|
||||
|
||||
json[:entries][0][:helpers][:name].should == "Private"
|
||||
json[:entries][0][:helpers][:description].should == "Private"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue