Remove deprecated error callback to Discourse.ajax

This commit is contained in:
Robin Ward 2015-02-05 10:44:33 -05:00
parent ef6868d870
commit c3874b6ec9
2 changed files with 17 additions and 18 deletions

View File

@ -186,25 +186,25 @@ Discourse.Topic = Discourse.Model.extend({
this.toggleProperty('bookmarked');
if (this.get("postStream.firstPostPresent")) { firstPost.toggleProperty("bookmarked"); }
return Discourse.ajax('/t/' + this.get('id') + '/bookmark', {
type: 'PUT',
data: { bookmarked: self.get('bookmarked') },
error: function(error){
self.toggleProperty('bookmarked');
if (self.get("postStream.firstPostPresent")) { firstPost.toggleProperty('bookmarked'); }
}).catch(function(error) {
self.toggleProperty('bookmarked');
if (self.get("postStream.firstPostPresent")) { firstPost.toggleProperty('bookmarked'); }
var showGenericError = true;
var showGenericError = true;
if (error && error.responseText) {
try {
bootbox.alert($.parseJSON(error.responseText).errors);
showGenericError = false;
} catch(e){}
}
if (error && error.responseText) {
try {
bootbox.alert($.parseJSON(error.responseText).errors);
showGenericError = false;
} catch(e){}
}
if(showGenericError){
bootbox.alert(I18n.t('generic_error'));
}
if(showGenericError){
bootbox.alert(I18n.t('generic_error'));
}
});
},

View File

@ -7,19 +7,18 @@ export default Discourse.View.extend(StringBuffer, {
classNameBindings: ['controller.checked',
':topic-list-item',
'unboundClassNames',
'selected'
],
'selected'],
actions: {
select: function(){
this.set('controller.selectedRow', this);
},
toggleBookmark: function(){
toggleBookmark: function() {
var self = this;
this.get('topic').toggleBookmark().catch(function(){
this.get('topic').toggleBookmark().finally(function() {
self.rerender();
});
self.rerender();
}
},