diff --git a/Gemfile b/Gemfile index 387d5508..c032af7a 100644 --- a/Gemfile +++ b/Gemfile @@ -74,7 +74,7 @@ gem 'redis', '~> 4.1', require: ['redis', 'redis/connection/hiredis'] gem 'mario-redis-lock', '~> 1.2', require: 'redis_lock' gem 'rqrcode', '~> 0.10' gem 'sanitize', '~> 5.0' -gem 'sidekiq', '~> 5.2' +gem 'sidekiq', '~> 6.0' gem 'sidekiq-scheduler', '~> 3.0' gem 'sidekiq-unique-jobs', '~> 6.0' gem 'sidekiq-bulk', '~>0.2.0' diff --git a/Gemfile.lock b/Gemfile.lock index 5d095708..0374ae6d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -152,7 +152,7 @@ GEM climate_control (>= 0.0.3, < 1.0) coderay (1.1.2) concurrent-ruby (1.1.5) - connection_pool (2.2.2) + connection_pool (2.2.3) crack (0.4.3) safe_yaml (~> 1.0.0) crass (1.0.4) @@ -426,12 +426,10 @@ GEM pundit (2.0.1) activesupport (>= 3.0.0) raabro (1.1.6) - rack (2.0.7) + rack (2.2.3) rack-attack (6.0.0) rack (>= 1.0, < 3) rack-cors (1.0.3) - rack-protection (2.0.5) - rack rack-proxy (0.6.5) rack rack-test (1.1.0) @@ -480,7 +478,7 @@ GEM rdf-normalize (0.3.3) rdf (>= 2.2, < 4.0) redcarpet (3.4.0) - redis (4.1.2) + redis (4.2.5) redis-actionpack (5.0.2) actionpack (>= 4.0, < 6) redis-rack (>= 1, < 3) @@ -554,11 +552,10 @@ GEM scss_lint (0.58.0) rake (>= 0.9, < 13) sass (~> 3.5, >= 3.5.5) - sidekiq (5.2.7) - connection_pool (~> 2.2, >= 2.2.2) - rack (>= 1.5.0) - rack-protection (>= 1.5.0) - redis (>= 3.3.5, < 5) + sidekiq (6.1.2) + connection_pool (>= 2.2.2) + rack (~> 2.0) + redis (>= 4.2.0) sidekiq-bulk (0.2.0) sidekiq sidekiq-scheduler (3.0.0) @@ -751,7 +748,7 @@ DEPENDENCIES rubocop (~> 0.71) sanitize (~> 5.0) scss_lint (~> 0.58) - sidekiq (~> 5.2) + sidekiq (~> 6.0) sidekiq-bulk (~> 0.2.0) sidekiq-scheduler (~> 3.0) sidekiq-unique-jobs (~> 6.0) diff --git a/app/controllers/api/v1/timelines/list_controller.rb b/app/controllers/api/v1/timelines/list_controller.rb index a15eae46..1447817f 100644 --- a/app/controllers/api/v1/timelines/list_controller.rb +++ b/app/controllers/api/v1/timelines/list_controller.rb @@ -18,6 +18,7 @@ class Api::V1::Timelines::ListController < Api::BaseController def set_list @list = List.where(account: current_account).find(params[:id]) + @accounts = ListAccount.select('account_id').where(list_id: @list) end def set_statuses @@ -29,16 +30,14 @@ class Api::V1::Timelines::ListController < Api::BaseController end def list_statuses - list_feed.get( + statuses = Status.where( + account: @accounts, reply: false + ).where( + 'updated_at > ?', 10.days.ago + ).paginate_by_id( limit_param(DEFAULT_STATUSES_LIMIT), - params[:max_id], - params[:since_id], - params[:min_id] - ) - end - - def list_feed - ListFeed.new(@list) + params_slice(:max_id, :since_id, :min_id) + ).reject { |status| FeedManager.instance.filter?(:home, status, current_account.id) } end def insert_pagination_headers diff --git a/app/javascript/gabsocial/components/modal/edit_profile_modal.js b/app/javascript/gabsocial/components/modal/edit_profile_modal.js index 693a7e43..c2993d7c 100644 --- a/app/javascript/gabsocial/components/modal/edit_profile_modal.js +++ b/app/javascript/gabsocial/components/modal/edit_profile_modal.js @@ -98,8 +98,8 @@ class EditProfileModal extends ImmutablePureComponent { if (account.get('avatar_static') !== avatarSrc) obj.avatar = avatarSrc if (account.get('header_static') !== headerSrc) obj.header = headerSrc - this.props.onSave(obj) - this.handleOnClose() + this.props.onSave(obj, this.handleOnClose) + //this.handleOnClose() } render() { @@ -210,7 +210,7 @@ const mapStateToProps = (state) => ({ }) const mapDispatchToProps = (dispatch) => ({ - onSave: (data) => dispatch(saveUserProfileInformation(data)), + onSave: (data, closer) => dispatch(saveUserProfileInformation(data, closer)), }) EditProfileModal.propTypes = { diff --git a/app/javascript/gabsocial/components/popover/group_timeline_sort_top_options_popover.js b/app/javascript/gabsocial/components/popover/group_timeline_sort_top_options_popover.js index 6cfa350a..3b04cb06 100644 --- a/app/javascript/gabsocial/components/popover/group_timeline_sort_top_options_popover.js +++ b/app/javascript/gabsocial/components/popover/group_timeline_sort_top_options_popover.js @@ -56,12 +56,14 @@ class GroupTimelineSortTopOptionsPopover extends React.PureComponent { title: intl.formatMessage(messages.topYearTitle), onClick: () => this.handleOnClick(GROUP_TIMELINE_SORTING_TYPE_TOP_OPTION_YEARLY), }, + /* { hideArrow: true, isActive: sortByTopValue === GROUP_TIMELINE_SORTING_TYPE_TOP_OPTION_ALL_TIME, title: intl.formatMessage(messages.topAllTitle), onClick: () => this.handleOnClick(GROUP_TIMELINE_SORTING_TYPE_TOP_OPTION_ALL_TIME), }, + */ ] return ( diff --git a/app/javascript/gabsocial/reducers/user.js b/app/javascript/gabsocial/reducers/user.js index 3b23a7b1..d66dc8d1 100644 --- a/app/javascript/gabsocial/reducers/user.js +++ b/app/javascript/gabsocial/reducers/user.js @@ -19,6 +19,7 @@ export default function (state = initialState, action) { case SAVE_USER_PROFILE_INFORMATION_FETCH_SUCCESS: return state case SAVE_USER_PROFILE_INFORMATION_FETCH_FAIL: + alert('Failed to update your profile. Max profile image size is 2MB. Please update and try again.') return state.set('isError', true) case RESEND_USER_CONFIRMATION_EMAIL_SUCCESS: return state.set('emailConfirmationResends', state.get('emailConfirmationResends') + 1) diff --git a/app/models/status.rb b/app/models/status.rb index c6d907ee..082d1363 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -90,7 +90,7 @@ class Status < ApplicationRecord default_scope { recent } - scope :recent, -> { reorder(created_at: :desc) } + scope :recent, -> { reorder(updated_at: :desc) } scope :remote, -> { where(local: false).or(where.not(uri: nil)) } scope :local, -> { where(local: true).or(where(uri: nil)) } @@ -290,13 +290,14 @@ class Status < ApplicationRecord end def as_home_timeline(account) - query = where('updated_at > ?', 30.days.ago) + query = where('updated_at > ?', 5.days.ago) query.where(visibility: [:public, :unlisted, :private]) query.where(account: [account] + account.following).without_replies end def as_group_timeline(group) - where(group: group).without_replies + query = where('updated_at > ?', 5.days.ago) + query.where(group: group).without_replies end def as_group_collection_timeline(groupIds) diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 93a88fae..f224f6a8 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -2,8 +2,16 @@ class FanOutOnWriteService < BaseService + # Push a status into home and mentions feeds + # @param [Status] status def call(status) - deliver_to_self(status) if status.account.local? + raise GabSocial::RaceConditionError if status.visibility.nil? + + if status.direct_visibility? || status.limited_visibility? + # + else + deliver_to_self(status) if status.account.local? + end end private diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb index ce4185e0..314d3e05 100644 --- a/config/initializers/paperclip.rb +++ b/config/initializers/paperclip.rb @@ -37,7 +37,7 @@ if ENV['S3_ENABLED'] == 'true' s3_options: { signature_version: ENV.fetch('S3_SIGNATURE_VERSION') { 'v4' }, http_open_timeout: 5, - http_read_timeout: 5, + http_read_timeout: 30, http_idle_timeout: 5, } ) diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 7f8a40d7..288453a0 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -19,4 +19,4 @@ Sidekiq.configure_client do |config| config.redis = redis_params end -Sidekiq::Logging.logger.level = ::Logger.const_get(ENV.fetch('RAILS_LOG_LEVEL', 'info').upcase.to_s) +Sidekiq.logger.level = ::Logger.const_get(ENV.fetch('RAILS_LOG_LEVEL', 'info').upcase.to_s) diff --git a/lib/gabsocial/domains_cli.rb b/lib/gabsocial/domains_cli.rb index 231fd800..8b1f4c47 100644 --- a/lib/gabsocial/domains_cli.rb +++ b/lib/gabsocial/domains_cli.rb @@ -39,6 +39,34 @@ module GabSocial say("Removed #{custom_emojis_count} custom emojis", :green) end + option :dry_run, type: :boolean + desc 'deleteallremote', 'Remove all remote data' + def deleteallremote + dry_run = options[:dry_run] ? ' (DRY RUN)' : '' + + Account.remote.by_domain_accounts.find_in_batches do |acct| + domain = acct.domain + + say("\n\n\n - Starting domain block for #{domain} #{dry_run}", :green) + + if domain.present? + existing_domain_block = DomainBlock.find_by(domain: domain) + + unless existing_domain_block.present? + say("\nDomain block for #{domain} is starting #{dry_run}", :green) + unless options[:dry_run] + domain_block = DomainBlock.new(domain: domain, severity: :suspend) + DomainBlockWorker.perform_async(domain_block.id) + end + else + say("\nDomain block for #{domain} is already implemented #{dry_run}", :red) + end + end + end + + say('\n\n - Domain block deleteallremote done', :green) + end + option :concurrency, type: :numeric, default: 50, aliases: [:c] option :silent, type: :boolean, default: false, aliases: [:s] option :format, type: :string, default: 'summary', aliases: [:f]