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

View File

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

View File

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