Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
diaspora
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Gigadoc 2
diaspora
Commits
bc5848fe
Commit
bc5848fe
authored
Nov 26, 2016
by
Steffen van Bergerem
Committed by
Benjamin Neff
Jan 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use new ajax error handling for reshare failures
parent
d609238e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
14 deletions
+5
-14
app/assets/javascripts/mobile/mobile_post_actions.js
app/assets/javascripts/mobile/mobile_post_actions.js
+1
-5
spec/javascripts/mobile/mobile_post_actions_spec.js
spec/javascripts/mobile/mobile_post_actions_spec.js
+4
-9
No files found.
app/assets/javascripts/mobile/mobile_post_actions.js
View file @
bc5848fe
...
...
@@ -99,11 +99,7 @@
Diaspora
.
Mobile
.
PostActions
.
toggleActive
(
link
);
},
error
:
function
(
response
)
{
if
(
response
.
status
===
0
)
{
alert
(
Diaspora
.
I18n
.
t
(
"
errors.connection
"
));
}
else
{
alert
(
response
.
responseText
);
}
Diaspora
.
Mobile
.
Alert
.
handleAjaxError
(
response
);
},
complete
:
function
()
{
Diaspora
.
Mobile
.
PostActions
.
hideLoader
(
link
);
...
...
spec/javascripts/mobile/mobile_post_actions_spec.js
View file @
bc5848fe
...
...
@@ -198,7 +198,6 @@ describe("Diaspora.Mobile.PostActions", function(){
Diaspora
.
Mobile
.
PostActions
.
initialize
();
this
.
reshareLink
=
$
(
"
.stream .reshare-action
"
);
spyOn
(
window
,
"
confirm
"
).
and
.
returnValue
(
true
);
spyOn
(
window
,
"
alert
"
);
});
it
(
"
always calls showLoader before sending request and hideLoader after receiving response
"
,
function
(){
...
...
@@ -223,16 +222,12 @@ describe("Diaspora.Mobile.PostActions", function(){
expect
(
Diaspora
.
Mobile
.
PostActions
.
toggleActive
).
toHaveBeenCalledWith
(
this
.
reshareLink
);
});
it
(
"
pops an alert on server errors
"
,
function
()
{
it
(
"
lets Diaspora.Mobile.Alert handle AJAX errors
"
,
function
()
{
spyOn
(
Diaspora
.
Mobile
.
Alert
,
"
handleAjaxError
"
);
this
.
reshareLink
.
click
();
jasmine
.
Ajax
.
requests
.
mostRecent
().
respondWith
({
status
:
400
,
responseText
:
"
reshare failed
"
});
expect
(
window
.
alert
).
toHaveBeenCalledWith
(
"
reshare failed
"
);
});
it
(
"
pops an alert on network errors
"
,
function
()
{
this
.
reshareLink
.
click
();
jasmine
.
Ajax
.
requests
.
mostRecent
().
abort
();
expect
(
window
.
alert
).
toHaveBeenCalledWith
(
Diaspora
.
I18n
.
t
(
"
errors.connection
"
));
expect
(
Diaspora
.
Mobile
.
Alert
.
handleAjaxError
).
toHaveBeenCalled
();
expect
(
Diaspora
.
Mobile
.
Alert
.
handleAjaxError
.
calls
.
argsFor
(
0
)[
0
].
responseText
).
toBe
(
"
reshare failed
"
);
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment