BUGFIX: New status posts weren't using PostCreator
This commit is contained in:
parent
473a64d39d
commit
a819a26f34
|
@ -102,12 +102,8 @@ Discourse.MessageBus = (function() {
|
|||
if (failCount > 2) {
|
||||
interval = interval * failCount;
|
||||
} else if (isHidden()) {
|
||||
/* slowning down stuff a lot when hidden
|
||||
*/
|
||||
|
||||
/* we will need to add a lot of fine tuning here
|
||||
*/
|
||||
|
||||
// slowning down stuff a lot when hidden
|
||||
// we will need to add a lot of fine tuning here
|
||||
interval = interval * 4;
|
||||
}
|
||||
if (interval > _this.maxPollInterval) {
|
||||
|
|
|
@ -309,6 +309,7 @@ Discourse.TopicController = Discourse.ObjectController.extend({
|
|||
})) {
|
||||
return;
|
||||
}
|
||||
|
||||
topic.set('posts_count', topic.get('posts_count') + 1);
|
||||
topic.set('highest_post_number', data.post_number);
|
||||
topic.set('last_poster', data.user);
|
||||
|
|
|
@ -350,11 +350,11 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
|
|||
},
|
||||
|
||||
nonUrgentPositionUpdate: Discourse.debounce(function(opts){
|
||||
var screenTrack = this.get('screenTrack');
|
||||
if(opts.userActive && screenTrack) {
|
||||
screenTrack.scrolled();
|
||||
}
|
||||
this.set('controller.currentPost', opts.currentPost);
|
||||
var screenTrack = this.get('screenTrack');
|
||||
if(opts.userActive && screenTrack) {
|
||||
screenTrack.scrolled();
|
||||
}
|
||||
this.set('controller.currentPost', opts.currentPost);
|
||||
},500),
|
||||
|
||||
scrolled: function(){
|
||||
|
|
|
@ -322,12 +322,16 @@ class Topic < ActiveRecord::Base
|
|||
def add_moderator_post(user, text, opts={})
|
||||
new_post = nil
|
||||
Topic.transaction do
|
||||
new_post = posts.create(user: user, raw: text, post_type: Post.types[:moderator_action], no_bump: opts[:bump].blank?)
|
||||
creator = PostCreator.new(user,
|
||||
raw: text,
|
||||
post_type: Post.types[:moderator_action],
|
||||
no_bump: opts[:bump].blank?,
|
||||
topic_id: self.id)
|
||||
new_post = creator.create
|
||||
increment!(:moderator_posts_count)
|
||||
new_post
|
||||
end
|
||||
|
||||
|
||||
if new_post.present?
|
||||
# If we are moving posts, we want to insert the moderator post where the previous posts were
|
||||
# in the stream, not at the end.
|
||||
|
|
|
@ -77,6 +77,9 @@ class PostCreator
|
|||
post = topic.posts.new(raw: @opts[:raw],
|
||||
user: @user,
|
||||
reply_to_post_number: @opts[:reply_to_post_number])
|
||||
|
||||
post.post_type = @opts[:post_type] if @opts[:post_type].present?
|
||||
post.no_bump = @opts[:no_bump] if @opts[:no_bump].present?
|
||||
post.extract_quoted_post_numbers
|
||||
|
||||
post.image_sizes = @opts[:image_sizes] if @opts[:image_sizes].present?
|
||||
|
|
Loading…
Reference in New Issue