Fixes for news and injection links

• Fixes:
- for news and injection links
This commit is contained in:
mgabdev 2020-09-14 22:16:21 -05:00
parent 105d8320e8
commit a842bfb20b
3 changed files with 17 additions and 16 deletions

View File

@ -71,7 +71,7 @@ class Api::V1::Timelines::ExploreController < Api::BaseController
reply: false
).paginate_by_id(
limit_param(DEFAULT_STATUSES_LIMIT),
params_slice(:max_id, :since_id, :min_id)
params_slice(:max_id, :since_id)
).reject { |status| FeedManager.instance.filter?(:home, status, current_account.id) }
elsif @sort_type == 'recent'
statuses = Status.with_public_visibility.where(
@ -80,16 +80,15 @@ class Api::V1::Timelines::ExploreController < Api::BaseController
'status_stats.replies_count > 0 OR status_stats.reblogs_count > 0 OR status_stats.favourites_count > 0'
).order('status_stats.updated_at DESC').paginate_by_id(
limit_param(DEFAULT_STATUSES_LIMIT),
params_slice(:max_id, :since_id, :min_id)
params_slice(:max_id, :since_id)
).reject { |status| FeedManager.instance.filter?(:home, status, current_account.id) }
elsif ['top_today', 'top_weekly', 'top_monthly', 'top_yearly', 'top_all_time', 'hot'].include? @sort_type
if @sort_type == 'top_all_time'
statuses = Status.unscoped.with_public_visibility.where(
reply: false
).joins(:status_stat).order(top_order)
.paginate_by_id(
).joins(:status_stat).order(top_order).paginate_by_id(
limit_param(DEFAULT_STATUSES_LIMIT),
params_slice(:max_id, :since_id, :min_id)
params_slice(:max_id, :since_id)
).reject { |status| FeedManager.instance.filter?(:home, status, current_account.id) }
elsif @sort_type == 'hot'
statuses = Status.unscoped.with_public_visibility.where(
@ -98,7 +97,7 @@ class Api::V1::Timelines::ExploreController < Api::BaseController
'statuses.created_at > ?', date_limit
).joins(:status_stat).order(top_order).paginate_by_id(
limit_param(DEFAULT_STATUSES_LIMIT),
params_slice(:max_id, :since_id, :min_id)
params_slice(:max_id, :since_id)
).reject { |status| FeedManager.instance.filter?(:home, status, current_account.id) }
else
statuses = Status.unscoped.with_public_visibility.where(
@ -107,7 +106,7 @@ class Api::V1::Timelines::ExploreController < Api::BaseController
'statuses.created_at > ?', date_limit
).joins(:status_stat).order(top_order).paginate_by_id(
limit_param(DEFAULT_STATUSES_LIMIT),
params_slice(:max_id, :since_id, :min_id)
params_slice(:max_id, :since_id)
).reject { |status| FeedManager.instance.filter?(:home, status, current_account.id) }
end
end
@ -117,7 +116,7 @@ class Api::V1::Timelines::ExploreController < Api::BaseController
reply: false
).paginate_by_id(
limit_param(DEFAULT_STATUSES_LIMIT),
params_slice(:max_id, :since_id, :min_id)
params_slice(:max_id, :since_id)
)
elsif @sort_type == 'recent'
statuses = Status.with_public_visibility.where(
@ -126,16 +125,15 @@ class Api::V1::Timelines::ExploreController < Api::BaseController
'status_stats.replies_count > 0 OR status_stats.reblogs_count > 0 OR status_stats.favourites_count > 0'
).order('status_stats.updated_at DESC').paginate_by_id(
limit_param(DEFAULT_STATUSES_LIMIT),
params_slice(:max_id, :since_id, :min_id)
params_slice(:max_id, :since_id)
)
elsif ['top_today', 'top_weekly', 'top_monthly', 'top_yearly', 'top_all_time', 'hot'].include? @sort_type
if @sort_type == 'top_all_time'
statuses = Status.unscoped.with_public_visibility.where(
reply: false
).joins(:status_stat).order(top_order)
.paginate_by_id(
).joins(:status_stat).order(top_order).paginate_by_id(
limit_param(DEFAULT_STATUSES_LIMIT),
params_slice(:max_id, :since_id, :min_id)
params_slice(:max_id, :since_id)
)
else
statuses = Status.unscoped.with_public_visibility.where(
@ -144,7 +142,7 @@ class Api::V1::Timelines::ExploreController < Api::BaseController
'statuses.created_at > ?', date_limit
).joins(:status_stat).order(top_order).paginate_by_id(
limit_param(DEFAULT_STATUSES_LIMIT),
params_slice(:max_id, :since_id, :min_id)
params_slice(:max_id, :since_id)
)
end
end

View File

@ -37,6 +37,7 @@ class TimelineInjectionLayout extends React.PureComponent {
subtitle,
children,
buttonLink,
buttonHref,
buttonTitle,
isXS,
} = this.props
@ -90,6 +91,7 @@ class TimelineInjectionLayout extends React.PureComponent {
color='none'
backgroundColor='none'
to={buttonLink}
href={buttonHref}
className={[_s.px15, _s.py15, _s.bgSubtle_onHover].join(' ')}
>
<Text color='brand' align='center' size='medium'>
@ -106,6 +108,7 @@ class TimelineInjectionLayout extends React.PureComponent {
TimelineInjectionLayout.propTypes = {
title: PropTypes.string,
buttonLink: PropTypes.string,
buttonHref: PropTypes.string,
buttonTitle: PropTypes.string,
id: PropTypes.string.isRequired,
subtitle: PropTypes.string,

View File

@ -202,9 +202,9 @@ class News extends React.PureComponent {
}
const mapStateToProps = (state) => ({
isError: state.getIn(['gab_trends', 'partner', 'isError']),
isLoading: state.getIn(['gab_trends', 'partner', 'isLoading']),
items: state.getIn(['gab_trends', 'partner', 'items']),
isError: state.getIn(['gab', 'partner', 'isError']),
isLoading: state.getIn(['gab', 'partner', 'isLoading']),
items: state.getIn(['gab', 'partner', 'items']),
})
const mapDispatchToProps = (dispatch) => ({