mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 03:33:58 -06:00
Remove deprecated error
callback to Discourse.ajax
This commit is contained in:
parent
ef6868d870
commit
c3874b6ec9
@ -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'));
|
||||
}
|
||||
});
|
||||
},
|
||||
|
@ -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();
|
||||
}
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user