* VRFS-1474 cleaned up some error case dialogs
This commit is contained in:
parent
d6210c0b2f
commit
1aef96b697
|
|
@ -138,11 +138,22 @@
|
|||
}
|
||||
|
||||
$dialogContents.append(contents);
|
||||
|
||||
context.JK.bindHoverEvents(contents);
|
||||
})
|
||||
.fail(function(jqXHR) {
|
||||
app.notifyServerError(jqXHR, 'Unable to Load Friend Request')
|
||||
if(jqXHR.status == 403) {
|
||||
var contents = renderGenericError({error_message: 'You do not have permission to access this information.'})
|
||||
$dialogContents.append(contents);
|
||||
context.JK.bindHoverEvents(contents);
|
||||
}
|
||||
else if(jqXHR.status == 404) {
|
||||
var contents = renderGenericError({error_message: 'This friend request no longer exists.'})
|
||||
$dialogContents.append(contents);
|
||||
context.JK.bindHoverEvents(contents);
|
||||
}
|
||||
else {
|
||||
app.notifyServerError(jqXHR, 'Unable to Load Friend Request');
|
||||
}
|
||||
renderNoActionPossibleBtns();
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -75,6 +75,32 @@ describe "Accept Friend Request", :js => true, :type => :feature, :capybara_feat
|
|||
find('#accept-friend-request-dialog .btn-close-dialog', text: 'CLOSE').trigger(:click)
|
||||
page.should_not have_selector('h1', text: 'friend request')
|
||||
end
|
||||
|
||||
it "no longer exists" do
|
||||
visit '/'
|
||||
should_be_at_root
|
||||
visit Nav.accept_friend_request_dialog('junk')
|
||||
|
||||
find('h1', text: 'friend request')
|
||||
find('.generic-error-msg', 'This friend request no longer exists.')
|
||||
find('#accept-friend-request-dialog .btn-close-dialog', text: 'CLOSE').trigger(:click)
|
||||
page.should_not have_selector('h1', text: 'friend request')
|
||||
end
|
||||
|
||||
it "no permission" do
|
||||
user3 = FactoryGirl.create(:user)
|
||||
friend_request.friend = user3
|
||||
friend_request.save!
|
||||
|
||||
visit '/'
|
||||
should_be_at_root
|
||||
visit Nav.accept_friend_request_dialog(friend_request.id)
|
||||
|
||||
find('h1', text: 'friend request')
|
||||
find('.generic-error-msg', 'You do not have permission to access this information.')
|
||||
find('#accept-friend-request-dialog .btn-close-dialog', text: 'CLOSE').trigger(:click)
|
||||
page.should_not have_selector('h1', text: 'friend request')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue