Added/removed some functionality to better handle requests/load
- Removed status counting in dashboard for admins - Added limit to notifications to only 7 days ago - Removed ability for non-logged in users to view group, group-collection timelines - Limited account realtime search on compose, list, chat actions - Removed fetching of user suggestions - Removed fetching of shortcuts - Removed featured groups, user suggestions timeline injections - Removed group featured panel from explore layout for non logged in users - Removed media gallery panel from profile layout - Removed lists, suggestions, groups panel from home page - Removed user suggestions to list page - Updated pro_timelie in status.rb to find only from 1 hour ago - Updated home timeline to not include groups and to find only latest from 5 days ago - Removed search for non logged in users
This commit is contained in:
parent
c1213f4137
commit
f4512b4411
@ -5,7 +5,7 @@ module Admin
|
|||||||
class DashboardController < BaseController
|
class DashboardController < BaseController
|
||||||
def index
|
def index
|
||||||
@users_count = User.count
|
@users_count = User.count
|
||||||
@statuses_count = Status.count
|
@statuses_count = "." #Status.count
|
||||||
@pro_accounts_count = Account.where(is_pro: true).count
|
@pro_accounts_count = Account.where(is_pro: true).count
|
||||||
@donor_accounts_count = Account.where(is_donor: true).count
|
@donor_accounts_count = Account.where(is_donor: true).count
|
||||||
@registrations_week = Redis.current.get("activity:accounts:local:#{current_week}") || 0
|
@registrations_week = Redis.current.get("activity:accounts:local:#{current_week}") || 0
|
||||||
|
@ -36,7 +36,7 @@ class Api::V1::NotificationsController < Api::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def paginated_notifications
|
def paginated_notifications
|
||||||
browserable_account_notifications.paginate_by_id(
|
browserable_account_notifications.latest.paginate_by_id(
|
||||||
limit_param(DEFAULT_NOTIFICATIONS_LIMIT),
|
limit_param(DEFAULT_NOTIFICATIONS_LIMIT),
|
||||||
params_slice(:max_id, :since_id, :min_id)
|
params_slice(:max_id, :since_id, :min_id)
|
||||||
)
|
)
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Api::V1::SearchController < EmptyController
|
class Api::V1::SearchController < Api::BaseController
|
||||||
|
before_action :require_user!
|
||||||
|
|
||||||
RESULTS_LIMIT = 25
|
RESULTS_LIMIT = 25
|
||||||
|
|
||||||
def index
|
def index
|
||||||
|
@ -13,7 +13,7 @@ class Api::V1::Timelines::GroupCollectionController < Api::BaseController
|
|||||||
each_serializer: REST::StatusSerializer,
|
each_serializer: REST::StatusSerializer,
|
||||||
relationships: StatusRelationshipsPresenter.new(@statuses, current_account.id)
|
relationships: StatusRelationshipsPresenter.new(@statuses, current_account.id)
|
||||||
else
|
else
|
||||||
render json: @statuses, each_serializer: REST::StatusSerializer
|
render json: [], each_serializer: REST::StatusSerializer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,7 +54,8 @@ class Api::V1::Timelines::GroupController < Api::BaseController
|
|||||||
FeedManager.instance.filter?(:home, status, current_account.id)
|
FeedManager.instance.filter?(:home, status, current_account.id)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
SortingQueryBuilder.new.call(@sort_type, @group, params[:page])
|
return []
|
||||||
|
# SortingQueryBuilder.new.call(@sort_type, @group, params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -9,7 +9,7 @@ class Api::V1::Timelines::ListController < Api::BaseController
|
|||||||
after_action :insert_pagination_headers, unless: -> { @statuses.empty? }
|
after_action :insert_pagination_headers, unless: -> { @statuses.empty? }
|
||||||
|
|
||||||
def show
|
def show
|
||||||
render json: @statuses,
|
render json: [],
|
||||||
each_serializer: REST::StatusSerializer,
|
each_serializer: REST::StatusSerializer,
|
||||||
relationships: StatusRelationshipsPresenter.new(@statuses, current_user.account_id)
|
relationships: StatusRelationshipsPresenter.new(@statuses, current_user.account_id)
|
||||||
end
|
end
|
||||||
|
@ -21,6 +21,7 @@ export const fetchChatConversationAccountSuggestions = (query) => (dispatch, get
|
|||||||
|
|
||||||
export const debouncedFetchChatConversationAccountSuggestions = debounce((query, dispatch, getState) => {
|
export const debouncedFetchChatConversationAccountSuggestions = debounce((query, dispatch, getState) => {
|
||||||
if (!query) return
|
if (!query) return
|
||||||
|
return false
|
||||||
|
|
||||||
api(getState).get('/api/v1/accounts/search', {
|
api(getState).get('/api/v1/accounts/search', {
|
||||||
params: {
|
params: {
|
||||||
|
@ -537,6 +537,8 @@ const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, token) =>
|
|||||||
cancelFetchComposeSuggestionsAccounts()
|
cancelFetchComposeSuggestionsAccounts()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
|
||||||
api(getState).get('/api/v1/accounts/search', {
|
api(getState).get('/api/v1/accounts/search', {
|
||||||
cancelToken: new CancelToken(cancel => {
|
cancelToken: new CancelToken(cancel => {
|
||||||
cancelFetchComposeSuggestionsAccounts = cancel
|
cancelFetchComposeSuggestionsAccounts = cancel
|
||||||
|
@ -289,6 +289,8 @@ export const fetchListAccountsFail = (id, error) => ({
|
|||||||
export const fetchListSuggestions = (q) => (dispatch, getState) => {
|
export const fetchListSuggestions = (q) => (dispatch, getState) => {
|
||||||
if (!me) return
|
if (!me) return
|
||||||
|
|
||||||
|
return false
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
q,
|
q,
|
||||||
resolve: false,
|
resolve: false,
|
||||||
|
@ -34,13 +34,13 @@ class UserSuggestionsPanel extends ImmutablePureComponent {
|
|||||||
|
|
||||||
componentDidUpdate(prevProps, prevState) {
|
componentDidUpdate(prevProps, prevState) {
|
||||||
if (!prevState.fetched && this.state.fetched) {
|
if (!prevState.fetched && this.state.fetched) {
|
||||||
this.handleFetch()
|
// this.handleFetch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
if (!this.props.isLazy) {
|
if (!this.props.isLazy) {
|
||||||
this.handleFetch()
|
// this.handleFetch()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,6 +60,7 @@ class UserSuggestionsPanel extends ImmutablePureComponent {
|
|||||||
suggestionType,
|
suggestionType,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
|
return null
|
||||||
if (suggestions.isEmpty()) return null
|
if (suggestions.isEmpty()) return null
|
||||||
|
|
||||||
const Child = isLoading ? AccountPlaceholder : Account
|
const Child = isLoading ? AccountPlaceholder : Account
|
||||||
|
@ -21,7 +21,7 @@ class DefaultSidebar extends ImmutablePureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.onFetchShortcuts()
|
// this.props.onFetchShortcuts()
|
||||||
}
|
}
|
||||||
|
|
||||||
handleOpenSidebarMorePopover = () => {
|
handleOpenSidebarMorePopover = () => {
|
||||||
|
@ -55,6 +55,8 @@ class TimelineInjectionRoot extends React.PureComponent {
|
|||||||
//Since not on mobile this should not be visible
|
//Since not on mobile this should not be visible
|
||||||
if (!isXS && type === TIMELINE_INJECTION_PWA) return <div />
|
if (!isXS && type === TIMELINE_INJECTION_PWA) return <div />
|
||||||
|
|
||||||
|
if (type === TIMELINE_INJECTION_FEATURED_GROUPS || type === TIMELINE_INJECTION_USER_SUGGESTIONS) return <div />
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Bundle
|
<Bundle
|
||||||
|
@ -10,7 +10,7 @@ import List from '../components/list'
|
|||||||
class Shortcuts extends ImmutablePureComponent {
|
class Shortcuts extends ImmutablePureComponent {
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.onFetchShortcuts()
|
// this.props.onFetchShortcuts()
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
@ -20,6 +20,8 @@ class Shortcuts extends ImmutablePureComponent {
|
|||||||
shortcuts,
|
shortcuts,
|
||||||
} = this.props
|
} = this.props
|
||||||
|
|
||||||
|
return null
|
||||||
|
|
||||||
if (isError) {
|
if (isError) {
|
||||||
return <ColumnIndicator type='error' message='Error fetching shortcuts' />
|
return <ColumnIndicator type='error' message='Error fetching shortcuts' />
|
||||||
}
|
}
|
||||||
|
@ -65,10 +65,10 @@ class ExploreLayout extends ImmutablePureComponent {
|
|||||||
|
|
||||||
const layout = [
|
const layout = [
|
||||||
SignUpLogInPanel,
|
SignUpLogInPanel,
|
||||||
<WrappedBundle component={GroupsPanel} componentParams={{ groupType: 'featured' }} />,
|
|
||||||
]
|
]
|
||||||
if (!!me) {
|
if (!!me) {
|
||||||
layout.push(<WrappedBundle component={UserSuggestionsPanel} componentParams={{ isLazy: true, shouldLoad: lazyLoaded, suggestionType: 'verified' }} />)
|
layout.push(<WrappedBundle component={GroupsPanel} componentParams={{ groupType: 'featured' }} />)
|
||||||
|
// layout.push(<WrappedBundle component={UserSuggestionsPanel} componentParams={{ isLazy: true, shouldLoad: lazyLoaded, suggestionType: 'verified' }} />)
|
||||||
}
|
}
|
||||||
layout.push(<WrappedBundle component={TrendsBreakingPanel} componentParams={{ isLazy: true, shouldLoad: lazyLoaded }} />)
|
layout.push(<WrappedBundle component={TrendsBreakingPanel} componentParams={{ isLazy: true, shouldLoad: lazyLoaded }} />)
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ class ProfileLayout extends ImmutablePureComponent {
|
|||||||
<div className={[_s.d, _s.w340PX].join(' ')}>
|
<div className={[_s.d, _s.w340PX].join(' ')}>
|
||||||
<WrappedBundle component={ProfileStatsPanel} componentParams={{ account }} />
|
<WrappedBundle component={ProfileStatsPanel} componentParams={{ account }} />
|
||||||
<WrappedBundle component={ProfileInfoPanel} componentParams={{ account }} />
|
<WrappedBundle component={ProfileInfoPanel} componentParams={{ account }} />
|
||||||
{ !unavailable && <WrappedBundle component={MediaGalleryPanel} componentParams={{ account, isLazy: true, shouldLoad: lazyLoaded }} />}
|
{ /* !unavailable && <WrappedBundle component={MediaGalleryPanel} componentParams={{ account, isLazy: true, shouldLoad: lazyLoaded }} /> */ }
|
||||||
{ !me && <WrappedBundle component={SignUpPanel} /> }
|
{ !me && <WrappedBundle component={SignUpPanel} /> }
|
||||||
<WrappedBundle component={LinkFooter} />
|
<WrappedBundle component={LinkFooter} />
|
||||||
</div>
|
</div>
|
||||||
|
@ -101,9 +101,9 @@ class HomePage extends React.PureComponent {
|
|||||||
<WrappedBundle component={ProPanel} componentParams={{ isPro: isPro }} />,
|
<WrappedBundle component={ProPanel} componentParams={{ isPro: isPro }} />,
|
||||||
<WrappedBundle component={TrendsBreakingPanel} />,
|
<WrappedBundle component={TrendsBreakingPanel} />,
|
||||||
<WrappedBundle component={ShopPanel} componentParams={{ isLazy: true, shouldLoad: lazyLoaded }} />,
|
<WrappedBundle component={ShopPanel} componentParams={{ isLazy: true, shouldLoad: lazyLoaded }} />,
|
||||||
<WrappedBundle component={ListsPanel} componentParams={{ isLazy: true, shouldLoad: lazyLoaded }} />,
|
// <WrappedBundle component={ListsPanel} componentParams={{ isLazy: true, shouldLoad: lazyLoaded }} />,
|
||||||
<WrappedBundle component={UserSuggestionsPanel} componentParams={{ isLazy: true, shouldLoad: lazyLoaded }} />,
|
// <WrappedBundle component={UserSuggestionsPanel} componentParams={{ isLazy: true, shouldLoad: lazyLoaded }} />,
|
||||||
<WrappedBundle component={GroupsPanel} componentParams={{ isLazy: true, shouldLoad: lazyLoaded, groupType: 'member' }} />,
|
// <WrappedBundle component={GroupsPanel} componentParams={{ isLazy: true, shouldLoad: lazyLoaded, groupType: 'member' }} />,
|
||||||
LinkFooter,
|
LinkFooter,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
|
@ -54,7 +54,7 @@ class ListPage extends ImmutablePureComponent {
|
|||||||
layout={[
|
layout={[
|
||||||
<WrappedBundle component={ListDetailsPanel} componentParams={{ list: list, onEdit: this.handleOnOpenListEditModal }} />,
|
<WrappedBundle component={ListDetailsPanel} componentParams={{ list: list, onEdit: this.handleOnOpenListEditModal }} />,
|
||||||
TrendsBreakingPanel,
|
TrendsBreakingPanel,
|
||||||
UserSuggestionsPanel,
|
// UserSuggestionsPanel,
|
||||||
LinkFooter,
|
LinkFooter,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
|
@ -42,6 +42,7 @@ class Notification < ApplicationRecord
|
|||||||
validates :account_id, uniqueness: { scope: [:activity_type, :activity_id] }
|
validates :account_id, uniqueness: { scope: [:activity_type, :activity_id] }
|
||||||
validates :activity_type, inclusion: { in: TYPE_CLASS_MAP.values }
|
validates :activity_type, inclusion: { in: TYPE_CLASS_MAP.values }
|
||||||
|
|
||||||
|
scope :latest, -> { where('created_at < ?', 7.days.ago) }
|
||||||
scope :browserable, ->(exclude_types = [], account_id = nil, only_verified = false, only_following = false) {
|
scope :browserable, ->(exclude_types = [], account_id = nil, only_verified = false, only_following = false) {
|
||||||
types = TYPE_CLASS_MAP.values - activity_types_from_types(exclude_types + [:follow_request])
|
types = TYPE_CLASS_MAP.values - activity_types_from_types(exclude_types + [:follow_request])
|
||||||
|
|
||||||
|
@ -290,12 +290,7 @@ class Status < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def as_home_timeline(account)
|
def as_home_timeline(account)
|
||||||
query = where('created_at > ?', 21.days.ago)
|
query = where('created_at > ?', 5.days.ago)
|
||||||
query.where(visibility: [:public, :unlisted]).or(
|
|
||||||
where(visibility: [:private]).where('group is null')
|
|
||||||
).or(
|
|
||||||
where(visibility: [:private]).where(group: account.groups)
|
|
||||||
)
|
|
||||||
query.where(account: [account] + account.following).without_replies
|
query.where(account: [account] + account.following).without_replies
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -309,7 +304,7 @@ class Status < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
def as_pro_timeline(account = nil)
|
def as_pro_timeline(account = nil)
|
||||||
query = timeline_scope.without_replies.popular_accounts.where('statuses.updated_at > ?', 2.hours.ago)
|
query = timeline_scope.without_replies.popular_accounts.where('statuses.updated_at > ?', 1.hours.ago)
|
||||||
apply_timeline_filters(query, account)
|
apply_timeline_filters(query, account)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ class SearchService < BaseService
|
|||||||
|
|
||||||
if @query.present?
|
if @query.present?
|
||||||
results[:accounts] = perform_accounts_search! if account_searchable?
|
results[:accounts] = perform_accounts_search! if account_searchable?
|
||||||
results[:statuses] = perform_statuses_search! if full_text_searchable? && !account.nil?
|
results[:statuses] = [] # perform_statuses_search! if full_text_searchable? && !account.nil?
|
||||||
results[:links] = [] # perform_links_search! if !account.nil?
|
results[:links] = [] # perform_links_search! if !account.nil?
|
||||||
results[:groups] = perform_groups_search!
|
results[:groups] = perform_groups_search!
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user