mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FIX: Don't allow a user to stage a post while another is being staged.
This commit is contained in:
parent
d98f288aa4
commit
efd631296e
3 changed files with 21 additions and 5 deletions
|
@ -255,7 +255,8 @@ test("staging and undoing a new post", function() {
|
|||
});
|
||||
|
||||
// Stage the new post in the stream
|
||||
postStream.stagePost(stagedPost, user);
|
||||
var result = postStream.stagePost(stagedPost, user);
|
||||
equal(result, true, "it returns true");
|
||||
equal(topic.get('highest_post_number'), 2, "it updates the highest_post_number");
|
||||
ok(postStream.get('loading'), "it is loading while the post is being staged");
|
||||
|
||||
|
@ -290,11 +291,15 @@ test("staging and committing a post", function() {
|
|||
topic.set('posts_count', 1);
|
||||
|
||||
// Stage the new post in the stream
|
||||
postStream.stagePost(stagedPost, user);
|
||||
var result = postStream.stagePost(stagedPost, user);
|
||||
equal(result, true, "it returns true");
|
||||
ok(postStream.get('loading'), "it is loading while the post is being staged");
|
||||
stagedPost.setProperties({ id: 1234, raw: "different raw value" });
|
||||
equal(postStream.get('filteredPostsCount'), 1, "it retains the filteredPostsCount");
|
||||
|
||||
result = postStream.stagePost(stagedPost, user);
|
||||
equal(result, false, "you can't stage a post while it is currently staging");
|
||||
|
||||
postStream.commitPost(stagedPost);
|
||||
ok(postStream.get('posts').contains(stagedPost), "the post is still in the stream");
|
||||
ok(!postStream.get('loading'), "it is no longer loading");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue