Remove the distinction between "x replies below" and "x replies"
This commit is contained in:
parent
12d3c3b66b
commit
25e9cfe3b8
|
@ -277,15 +277,7 @@ window.Discourse.Composer = Discourse.Model.extend
|
|||
# If we're in a topic, we can append the post instantly.
|
||||
if topic
|
||||
# Increase the reply count
|
||||
if post
|
||||
post.set('reply_count', (post.get('reply_count') || 0) + 1)
|
||||
|
||||
# Supress replies
|
||||
if (post.get('reply_count') == 1 && createdPost.get('cooked').length < Discourse.SiteSettings.max_length_show_reply)
|
||||
post.set('replyFollowing', true)
|
||||
|
||||
post.set('reply_below_post_number', createdPost.get('post_number'))
|
||||
|
||||
post?.set('reply_count', (post.get('reply_count') || 0) + 1)
|
||||
topic.set('posts_count', topic.get('posts_count') + 1)
|
||||
|
||||
# Update last post
|
||||
|
|
|
@ -21,27 +21,6 @@ window.Discourse.Post = Ember.Object.extend Discourse.Presence,
|
|||
hasHistory: (-> @get('version') > 1 ).property('version')
|
||||
postElementId: (-> "post_#{@get('post_number')}").property()
|
||||
|
||||
# We only want to link to replies below if there's exactly one reply and it's below
|
||||
replyBelowUrlComputed: (->
|
||||
|
||||
return null unless @get('reply_below_post_number')
|
||||
return null if @get('reply_count') > 1
|
||||
|
||||
topic = @get('topic')
|
||||
return unless topic
|
||||
|
||||
p = @get('reply_below_post_number')
|
||||
diff = @get('reply_below_post_number') - @get('post_number')
|
||||
return topic.urlForPostNumber(p) if (diff < 3)
|
||||
null
|
||||
).property('topic', 'reply_below_post_number')
|
||||
|
||||
# We do this because right now you can't subclass a computed property and we want to add
|
||||
# plugin support. Later we should consider just subclassing it properly.
|
||||
replyBelowUrl: (->
|
||||
@get('replyBelowUrlComputed')
|
||||
).property('replyBelowUrlComputed')
|
||||
|
||||
# The class for the read icon of the post. It starts with read-icon then adds 'seen' or
|
||||
# 'last-read' if the post has been seen or is the highest post number seen so far respectively.
|
||||
bookmarkClass: (->
|
||||
|
|
|
@ -206,11 +206,6 @@ Discourse.Topic = Discourse.Model.extend Discourse.Presence,
|
|||
# when there
|
||||
lastPost = null
|
||||
result.posts.each (p) =>
|
||||
|
||||
# Determine whether there is a short reply below
|
||||
if (lastPost && lastPost.get('reply_count') == 1) && (p.reply_to_post_number == lastPost.get('post_number')) && (p.cooked.length < Discourse.SiteSettings.max_length_show_reply)
|
||||
lastPost.set('replyFollowing', true)
|
||||
|
||||
p.scrollToAfterInsert = opts.nearPost
|
||||
post = Discourse.Post.create(p)
|
||||
post.set('topic', @)
|
||||
|
|
|
@ -26,7 +26,7 @@ window.Discourse.PostMenuView = Ember.View.extend Discourse.Presence,
|
|||
# Trigger re rendering
|
||||
needsToRender: (->
|
||||
@rerender()
|
||||
).observes('post.deleted_at', 'post.flagsAvailable.@each', 'post.url', 'post.bookmarked', 'post.reply_count', 'post.replyBelowUrl', 'post.can_delete')
|
||||
).observes('post.deleted_at', 'post.flagsAvailable.@each', 'post.url', 'post.bookmarked', 'post.reply_count', 'post.can_delete')
|
||||
|
||||
# Replies Button
|
||||
renderReplies: (post, buffer) ->
|
||||
|
@ -39,8 +39,7 @@ window.Discourse.PostMenuView = Ember.View.extend Discourse.Presence,
|
|||
buffer.push("<button class='show-replies' data-action='replies'>")
|
||||
buffer.push("<span class='badge-posts'>#{reply_count}</span>")
|
||||
|
||||
textKey = if post.get('replyBelowUrl') then "post.has_replies" else "post.has_replies_below"
|
||||
buffer.push(Em.String.i18n(textKey, count: reply_count))
|
||||
buffer.push(Em.String.i18n("post.has_replies", count: reply_count))
|
||||
|
||||
icon = if @get('postView.repliesShown') then 'icon-chevron-up' else 'icon-chevron-down'
|
||||
buffer.push("<i class='icon #{icon}'></i></button>")
|
||||
|
|
|
@ -73,12 +73,6 @@ window.Discourse.PostView = Ember.View.extend
|
|||
|
||||
# Click on the replies button
|
||||
showReplies: ->
|
||||
|
||||
# If the reply is below, we route to it
|
||||
if replyBelowUrl = @get('post.replyBelowUrl')
|
||||
Discourse.routeTo(replyBelowUrl)
|
||||
return false
|
||||
|
||||
if @get('repliesShown')
|
||||
@set('repliesShown', false)
|
||||
else
|
||||
|
|
|
@ -473,8 +473,7 @@ class Post < ActiveRecord::Base
|
|||
if post.present?
|
||||
post_reply = post.post_replies.new(reply_id: self.id)
|
||||
if post_reply.save
|
||||
Post.update_all ['reply_count = reply_count + 1, reply_below_post_number = COALESCE(reply_below_post_number, ?)', self.post_number],
|
||||
["id = ?", post.id]
|
||||
Post.update_all ['reply_count = reply_count + 1'], id: post.id
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -15,7 +15,6 @@ class PostSerializer < ApplicationSerializer
|
|||
:updated_at,
|
||||
:reply_count,
|
||||
:reply_to_post_number,
|
||||
:reply_below_post_number,
|
||||
:quote_count,
|
||||
:avg_time,
|
||||
:incoming_link_count,
|
||||
|
|
|
@ -778,7 +778,6 @@ en:
|
|||
reply:
|
||||
title: 'Reply'
|
||||
help: 'begin composing a reply to this topic'
|
||||
below: 'reply below'
|
||||
|
||||
share:
|
||||
title: 'Share'
|
||||
|
@ -837,10 +836,6 @@ en:
|
|||
follow_quote: "go to the quoted post"
|
||||
deleted_by_author: "(post removed by author)"
|
||||
|
||||
has_replies_below:
|
||||
one: "Reply Below"
|
||||
other: "Replies Below"
|
||||
|
||||
has_replies:
|
||||
one: "Reply"
|
||||
other: "Replies"
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class RemoveReplyBelowPostNumberFromPosts < ActiveRecord::Migration
|
||||
def change
|
||||
remove_column :posts, :reply_below_post_number
|
||||
end
|
||||
end
|
2045
db/structure.sql
2045
db/structure.sql
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue