mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Remove the distinction between "x replies below" and "x replies"
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user