Browse Source

闭社树每次只加载两层

pull/4/head
欧醚 4 years ago
parent
commit
0414dccfe9
3 changed files with 6 additions and 4 deletions
  1. +5
    -1
      app/controllers/api/v1/statuses_controller.rb
  2. +1
    -1
      app/javascript/mastodon/components/status_action_bar.js
  3. +0
    -2
      app/javascript/mastodon/features/status/index.js

+ 5
- 1
app/controllers/api/v1/statuses_controller.rb View File

@ -23,7 +23,11 @@ class Api::V1::StatusesController < Api::BaseController
def context
ancestors_results = @status.in_reply_to_id.nil? ? [] : @status.ancestors(CONTEXT_LIMIT, current_account)
descendants_results = @status.descendants(CONTEXT_LIMIT, current_account)
treeId = ENV['TREE_ADDRESS'].split('/')[-1].to_i
isTree = @status.id == treeId || (!ancestors_results.empty? && ancestors_results[0].id == treeId)
descendants_results = @status.descendants(CONTEXT_LIMIT, current_account, nil, nil, isTree ? 2 : nil)
loaded_ancestors = cache_collection(ancestors_results, Status)
loaded_descendants = cache_collection(descendants_results, Status)

+ 1
- 1
app/javascript/mastodon/components/status_action_bar.js View File

@ -250,7 +250,7 @@ class StatusActionBar extends ImmutablePureComponent {
return (
<div className='status__action-bar'>
<div className='status__action-bar__counter'><IconButton className='status__action-bar-button' title={replyTitle} icon={status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) ? 'comments-o' : replyIcon} onClick={this.handleReplyClick} /><span className='status__action-bar__counter__label' >{obfuscatedCount(status.get('replies_count'))}</span></div>
<div className='status__action-bar__counter'><IconButton className='status__action-bar-button' disabled={!publicStatus} active={status.get('reblogged')} pressed={status.get('reblogged')} title={!publicStatus ? intl.formatMessage(messages.cannot_reblog) : intl.formatMessage(messages.reblog)} icon={reblogIcon} onClick={this.handleReblogClick} /><span className='status__action-bar__counter__label' >{publicStatus? obfuscatedCount(status.get('reblogs_count')) : ''}</span></div>
<div className='status__action-bar__counter'><IconButton className='status__action-bar-button' disabled={!publicStatus} active={status.get('reblogged')} pressed={status.get('reblogged')} title={!publicStatus ? intl.formatMessage(messages.cannot_reblog) : intl.formatMessage(messages.reblog)} icon={reblogIcon} onClick={this.handleReblogClick} />{publicStatus && <span className='status__action-bar__counter__label' >{obfuscatedCount(status.get('reblogs_count')) }</span>}</div>
<div className='status__action-bar__counter'><IconButton className='status__action-bar-button star-icon' animate active={status.get('favourited')} pressed={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='thumbs-up' onClick={this.handleFavouriteClick} /><span className='status__action-bar__counter__label' >{obfuscatedCount(status.get('favourites_count'))}</span></div>
{shareButton}

+ 0
- 2
app/javascript/mastodon/features/status/index.js View File

@ -480,8 +480,6 @@ class Status extends ImmutablePureComponent {
}
handleNodeClick = (ev, node) => {
console.log(node);
if (!this.context.router) {
return;
}

Loading…
Cancel
Save