[#8265] when undoing a spam, report it as ham. Show a message if something failed
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index 52a1b3c..7a38484 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -429,6 +429,8 @@
self.post.spam()
elif kw.pop('undo', None):
prev_status = kw.pop('prev_status', None)
+ if self.post.status == 'spam' and prev_status == 'ok':
+ g.spam_checker.submit_ham(self.post.text, artifact=self.post, user=self.post.author())
self.post.undo(prev_status)
elif kw.pop('approve', None):
if self.post.status != 'ok':
diff --git a/Allura/allura/lib/widgets/resources/js/post.js b/Allura/allura/lib/widgets/resources/js/post.js
index a4811dd..1da44aa 100644
--- a/Allura/allura/lib/widgets/resources/js/post.js
+++ b/Allura/allura/lib/widgets/resources/js/post.js
@@ -51,7 +51,10 @@
else if (mod == 'Undo'){
spam_block_display($(post), 'hide_spam');
}
- }
+ },
+ error: function() {
+ flash('Oops, something went wrong.', 'error')
+ },
});
});
@@ -80,7 +83,10 @@
} else {
flash('Error. Make sure you are logged in still.', 'error');
}
- }
+ },
+ error: function() {
+ flash('Oops, something went wrong.', 'error')
+ },
});
});