Responding to a friend request now only calls RequestsController#delete instead of also calling AspectsController#move_friend
This commit is contained in:
parent
1e842f1a88
commit
b77547e940
2 changed files with 16 additions and 11 deletions
|
|
@ -54,7 +54,8 @@ var AspectEdit = {
|
|||
});
|
||||
}
|
||||
|
||||
if (dropzone.attr('data-aspect_id') != person.attr('data-aspect_id')) {
|
||||
if (person.attr('data-aspect_id') != undefined && // request doesn't have an aspect ID yet
|
||||
dropzone.attr('data-aspect_id') != person.attr('data-aspect_id')) {
|
||||
$.ajax({
|
||||
url: "/aspects/move_friend/",
|
||||
data: {
|
||||
|
|
|
|||
|
|
@ -92,19 +92,18 @@ describe("AspectEdit", function() {
|
|||
});
|
||||
|
||||
describe("onDropMove", function() {
|
||||
beforeEach(function() {
|
||||
$('#jasmine_content').html(
|
||||
'<li class="person request ui-draggable" data-aspect_id="4cae42e12367bca44e000005" data-guid="4cae42d32367bca44e000003" style="top: 0px; left: 0px; ">' +
|
||||
' <img alt="Alexander Hamiltom" class="avatar" data-person_id="4cae42d32367bca44e000003" src="/images/user/default.png?1287542906" original-title="Alexander Hamiltom" style="height: 70px; width: 70px; opacity: 1; display: inline; ">' +
|
||||
'</li>' +
|
||||
'<ul data-aspect_id="4cdae5ed2367bc30aa000007" class="dropzone ui-droppable">' +
|
||||
'</ul>'
|
||||
);
|
||||
});
|
||||
describe("when dragging a friend request", function() {
|
||||
beforeEach(function() {
|
||||
$('#jasmine_content').html(
|
||||
'<li class="person request ui-draggable" data-person_id="4cae42d32367bca44e000003" data-guid="4cae42d32367bca44e000003">' +
|
||||
' <img alt="Alexander Hamiltom" class="avatar" data-person_id="4cae42d32367bca44e000003" src="/images/user/default.png?1287542906" original-title="Alexander Hamiltom">' +
|
||||
'</li>' +
|
||||
'<ul data-aspect_id="4cdae5ed2367bc30aa000007" class="dropzone ui-droppable">' +
|
||||
'</ul>'
|
||||
);
|
||||
});
|
||||
it("deletes the request object", function() {
|
||||
spyOn($, "ajax");
|
||||
AspectEdit.initialize();
|
||||
$.proxy(AspectEdit.onDropMove, $('.dropzone.ui-droppable'))(null, {draggable: $('.person.ui-draggable')});
|
||||
expect($.ajax).toHaveBeenCalled();
|
||||
var args = $.ajax.calls[0].args[0];
|
||||
|
|
@ -112,6 +111,11 @@ describe("AspectEdit", function() {
|
|||
expect(args["url"]).toEqual("/requests/4cae42d32367bca44e000003");
|
||||
expect(args["data"]).toEqual({"accept" : true, "aspect_id" : "4cdae5ed2367bc30aa000007" });
|
||||
});
|
||||
it("doesn't call move_friend", function() {
|
||||
spyOn($, "ajax");
|
||||
$.proxy(AspectEdit.onDropMove, $('.dropzone.ui-droppable'))(null, {draggable: $('.person.ui-draggable')});
|
||||
expect($.ajax.calls.length).toEqual(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue