From b75e34253c6db399ba6df2ce77a68a0612508b8f Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 13 Nov 2020 15:23:00 +0000 Subject: [PATCH 01/21] Changed home timeline to be last 5 days instead of 30 --- app/models/status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/status.rb b/app/models/status.rb index 0e3d355f..8dca56ec 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -302,7 +302,7 @@ 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 From 6a8a538d338178902a3ccc397cc9acc261029a66 Mon Sep 17 00:00:00 2001 From: admin Date: Fri, 13 Nov 2020 15:37:32 +0000 Subject: [PATCH 02/21] Added date constraint to as_group_timeline in status.rb --- app/models/status.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/status.rb b/app/models/status.rb index 8dca56ec..066a978e 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -308,7 +308,8 @@ class Status < ApplicationRecord 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) From 06125bf882b6c3e1472c76be770736e2ca6f4abb Mon Sep 17 00:00:00 2001 From: admin Date: Sat, 14 Nov 2020 13:14:33 +0000 Subject: [PATCH 03/21] change created_at to updated_at for recent statuses to use index --- app/models/status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/status.rb b/app/models/status.rb index 066a978e..7e3dbe8e 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -94,7 +94,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)) } From 3b13bb5087adbab2065961b73e95e7aa05e8f48e Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Sun, 15 Nov 2020 13:02:45 -0600 Subject: [PATCH 04/21] Updates to FanOutOnWriteService, FeedInsertWorker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updates: - to FanOutOnWriteService, FeedInsertWorker --- app/services/fan_out_on_write_service.rb | 61 +----------------------- app/workers/feed_insert_worker.rb | 5 -- 2 files changed, 2 insertions(+), 64 deletions(-) diff --git a/app/services/fan_out_on_write_service.rb b/app/services/fan_out_on_write_service.rb index 38fdb11f..85505b05 100644 --- a/app/services/fan_out_on_write_service.rb +++ b/app/services/fan_out_on_write_service.rb @@ -6,25 +6,10 @@ class FanOutOnWriteService < BaseService def call(status) raise GabSocial::RaceConditionError if status.visibility.nil? - render_anonymous_payload(status) - - if status.direct_visibility? - deliver_to_own_conversation(status) - elsif status.limited_visibility? - deliver_to_mentioned_followers(status) + if status.direct_visibility? || status.limited_visibility? + # else deliver_to_self(status) if status.account.local? - deliver_to_followers(status) - deliver_to_lists(status) - end - - return if status.account.silenced? || !status.public_visibility? || status.reblog? - - return if status.reply? && status.in_reply_to_account_id != status.account_id - - - if status.account.is_pro || status.account.is_donor || status.account.is_investor || status.account.is_verified - deliver_to_pro(status) end end @@ -35,46 +20,4 @@ class FanOutOnWriteService < BaseService FeedManager.instance.push_to_home(status.account, status) end - def deliver_to_followers(status) - Rails.logger.debug "Delivering status #{status.id} to followers" - - status.account.followers_for_local_distribution.select(:id).reorder(nil).find_in_batches do |followers| - FeedInsertWorker.push_bulk(followers) do |follower| - [status.id, follower.id, :home] - end - end - end - - def deliver_to_lists(status) - Rails.logger.debug "Delivering status #{status.id} to lists" - - status.account.lists_for_local_distribution.select(:id).reorder(nil).find_in_batches do |lists| - FeedInsertWorker.push_bulk(lists) do |list| - [status.id, list.id, :list] - end - end - end - - def deliver_to_mentioned_followers(status) - Rails.logger.debug "Delivering status #{status.id} to limited followers" - - FeedInsertWorker.push_bulk(status.mentions.includes(:account).map(&:account).select { |mentioned_account| mentioned_account.local? && mentioned_account.following?(status.account) }) do |follower| - [status.id, follower.id, :home] - end - end - - def render_anonymous_payload(status) - @payload = InlineRenderer.render(status, nil, :status) - @payload = Oj.dump(event: :update, payload: @payload) - end - - def deliver_to_pro(status) - Rails.logger.debug "Delivering status #{status.id} to pro timeline" - - Redis.current.publish('timeline:pro', @payload) - end - - def deliver_to_own_conversation(status) - AccountConversation.add_status(status.account, status) - end end diff --git a/app/workers/feed_insert_worker.rb b/app/workers/feed_insert_worker.rb index 1ae3c877..ec0af0cd 100644 --- a/app/workers/feed_insert_worker.rb +++ b/app/workers/feed_insert_worker.rb @@ -10,9 +10,6 @@ class FeedInsertWorker case @type when :home @follower = Account.find(id) - when :list - @list = List.find(id) - @follower = @list.account end check_and_insert @@ -36,8 +33,6 @@ class FeedInsertWorker case @type when :home FeedManager.instance.push_to_home(@follower, @status) - when :list - FeedManager.instance.push_to_list(@list, @status) end end end From 3ce337de870704d322cce4014bf8d98d4439d2da Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 15 Nov 2020 20:28:39 +0000 Subject: [PATCH 05/21] Update Gemfile --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 387d5508..ebe47931 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.1' gem 'sidekiq-scheduler', '~> 3.0' gem 'sidekiq-unique-jobs', '~> 6.0' gem 'sidekiq-bulk', '~>0.2.0' From b7021b0819accc1ed13eced27db47a987012b20e Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 15 Nov 2020 20:29:11 +0000 Subject: [PATCH 06/21] Update Gemfile.lock --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5d095708..e9383094 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -554,7 +554,7 @@ GEM scss_lint (0.58.0) rake (>= 0.9, < 13) sass (~> 3.5, >= 3.5.5) - sidekiq (5.2.7) + sidekiq (6.1.2) connection_pool (~> 2.2, >= 2.2.2) rack (>= 1.5.0) rack-protection (>= 1.5.0) From 66460a2e47ed4138cf7648b0d97d1d2ac3ffa57a Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 15 Nov 2020 20:36:13 +0000 Subject: [PATCH 07/21] Revert "Update Gemfile.lock" This reverts commit b7021b0819accc1ed13eced27db47a987012b20e --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index e9383094..5d095708 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -554,7 +554,7 @@ GEM scss_lint (0.58.0) rake (>= 0.9, < 13) sass (~> 3.5, >= 3.5.5) - sidekiq (6.1.2) + sidekiq (5.2.7) connection_pool (~> 2.2, >= 2.2.2) rack (>= 1.5.0) rack-protection (>= 1.5.0) From 360bdbc18c499c4dcc5a949399d5e0cd4d1cc0f4 Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 15 Nov 2020 20:36:24 +0000 Subject: [PATCH 08/21] Revert "Update Gemfile" This reverts commit 3ce337de870704d322cce4014bf8d98d4439d2da --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index ebe47931..387d5508 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', '~> 6.1' +gem 'sidekiq', '~> 5.2' gem 'sidekiq-scheduler', '~> 3.0' gem 'sidekiq-unique-jobs', '~> 6.0' gem 'sidekiq-bulk', '~>0.2.0' From 2a9bec5ec24bf02453aaf373755b6d4c492af8fd Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 15 Nov 2020 20:46:54 +0000 Subject: [PATCH 09/21] Update to sidekiq 6.0 --- Gemfile | 2 +- Gemfile.lock | 8 ++++---- config/initializers/sidekiq.rb | 2 +- spec/rails_helper.rb | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) 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..b565ad1a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -555,10 +555,10 @@ GEM 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) + connection_pool (>= 2.2.2) + rack (>= 2.0.0) + rack-protection (>= 2.0.0) + redis (>= 4.1.0) sidekiq-bulk (0.2.0) sidekiq sidekiq-scheduler (3.0.0) 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/spec/rails_helper.rb b/spec/rails_helper.rb index 7407e60a..17f1d518 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -15,7 +15,7 @@ ActiveRecord::Migration.maintain_test_schema! WebMock.disable_net_connect! Redis.current = Redis::Namespace.new("gabsocial_test#{ENV['TEST_ENV_NUMBER']}", redis: Redis.current) Sidekiq::Testing.inline! -Sidekiq::Logging.logger = nil +Sidekiq.logger = nil Devise::Test::ControllerHelpers.module_eval do alias_method :original_sign_in, :sign_in From 3fcf7fee0db51546f01cf726f11a1046ec0853d5 Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Fri, 20 Nov 2020 16:37:37 -0800 Subject: [PATCH 10/21] [group_collection_controller] add 7 day date constraint to main query. --- .../api/v1/timelines/group_collection_controller.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/controllers/api/v1/timelines/group_collection_controller.rb b/app/controllers/api/v1/timelines/group_collection_controller.rb index b08d0c90..6c5e6f79 100644 --- a/app/controllers/api/v1/timelines/group_collection_controller.rb +++ b/app/controllers/api/v1/timelines/group_collection_controller.rb @@ -72,7 +72,7 @@ class Api::V1::Timelines::GroupCollectionController < Api::BaseController return [] end - date_limit = 30.days.ago + date_limit = 7.days.ago top_order = 'status_stats.favourites_count DESC, status_stats.reblogs_count DESC, status_stats.replies_count DESC' if @sort_type == 'hot' @@ -94,6 +94,8 @@ class Api::V1::Timelines::GroupCollectionController < Api::BaseController if @sort_type == 'newest' statuses = Status.where( group: @groupIds, reply: false + ).where( + 'statuses.updated_at > ?', date_limit ).paginate_by_id( limit_param(DEFAULT_STATUSES_LIMIT), params_slice(:max_id, :since_id, :min_id) @@ -131,6 +133,8 @@ class Api::V1::Timelines::GroupCollectionController < Api::BaseController if @sort_type == 'newest' statuses = Status.where( group: @groupIds, reply: false + ).where( + 'statuses.created_at > ?', date_limit ).paginate_by_id(limit_param(DEFAULT_STATUSES_LIMIT), params_slice(:max_id, :since_id, :min_id)) elsif @sort_type == 'recent' statuses = Status.where( From 180be82c06a41536903d9298196c6cf239f6a02a Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Fri, 20 Nov 2020 19:16:49 -0800 Subject: [PATCH 11/21] [search] Remove All Time search option. --- .../popover/group_timeline_sort_top_options_popover.js | 2 ++ 1 file changed, 2 insertions(+) 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 ( From 62e8f846bcab5a7630bccd9267199e1835aff92b Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Fri, 20 Nov 2020 21:04:41 -0800 Subject: [PATCH 12/21] [Lists] Change data source and query method --- .../api/v1/timelines/list_controller.rb | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/app/controllers/api/v1/timelines/list_controller.rb b/app/controllers/api/v1/timelines/list_controller.rb index a15eae46..0d1b3746 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('follow_id').where(list_id: @list) end def set_statuses @@ -29,16 +30,12 @@ class Api::V1::Timelines::ListController < Api::BaseController end def list_statuses - list_feed.get( + statuses = Status.where( + account: @accounts, reply: false + ).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 From 0af28e9b0a9175634b5c189d3ac3c6c527846906 Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Fri, 20 Nov 2020 21:14:33 -0800 Subject: [PATCH 13/21] [Lists] Fix lists query --- app/controllers/api/v1/timelines/list_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/api/v1/timelines/list_controller.rb b/app/controllers/api/v1/timelines/list_controller.rb index 0d1b3746..fb5250f3 100644 --- a/app/controllers/api/v1/timelines/list_controller.rb +++ b/app/controllers/api/v1/timelines/list_controller.rb @@ -18,7 +18,7 @@ class Api::V1::Timelines::ListController < Api::BaseController def set_list @list = List.where(account: current_account).find(params[:id]) - @accounts = ListAccount.select('follow_id').where(list_id: @list) + @accounts = ListAccount.select('account_id').where(list_id: @list) end def set_statuses From b81b6ad1c271ecfbdf5706cf68e8f9e2dce5e65b Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Fri, 20 Nov 2020 21:30:03 -0800 Subject: [PATCH 14/21] [Lists] Add a 10 day limit to list query --- app/controllers/api/v1/timelines/list_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/api/v1/timelines/list_controller.rb b/app/controllers/api/v1/timelines/list_controller.rb index fb5250f3..1447817f 100644 --- a/app/controllers/api/v1/timelines/list_controller.rb +++ b/app/controllers/api/v1/timelines/list_controller.rb @@ -32,6 +32,8 @@ class Api::V1::Timelines::ListController < Api::BaseController def list_statuses statuses = Status.where( account: @accounts, reply: false + ).where( + 'updated_at > ?', 10.days.ago ).paginate_by_id( limit_param(DEFAULT_STATUSES_LIMIT), params_slice(:max_id, :since_id, :min_id) From 6a040c2a96e2287cebfe113bf683222036ae895b Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Sat, 21 Nov 2020 13:11:53 -0800 Subject: [PATCH 15/21] [user profile] handle errors in saving user profile edits --- app/javascript/gabsocial/actions/user.js | 3 ++- .../gabsocial/components/modal/edit_profile_modal.js | 6 +++--- app/javascript/gabsocial/reducers/user.js | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/javascript/gabsocial/actions/user.js b/app/javascript/gabsocial/actions/user.js index 4e9f93a0..97ead2f4 100644 --- a/app/javascript/gabsocial/actions/user.js +++ b/app/javascript/gabsocial/actions/user.js @@ -11,7 +11,7 @@ export const SAVE_USER_PROFILE_INFORMATION_FETCH_SUCCESS = 'SAVE_USER_PROFILE_IN export const SAVE_USER_PROFILE_INFORMATION_FETCH_FAIL = 'SAVE_USER_PROFILE_INFORMATION_FETCH_FAIL' export const RESEND_USER_CONFIRMATION_EMAIL_SUCCESS = 'RESEND_USER_CONFIRMATION_EMAIL_SUCCESS' -export const saveUserProfileInformation = (data) => { +export const saveUserProfileInformation = (data, closer) => { return function (dispatch, getState) { if (!isObject(data) || !me) return @@ -31,6 +31,7 @@ export const saveUserProfileInformation = (data) => { }).then((response) => { dispatch(importFetchedAccount(response.data)) dispatch(saveUserProfileInformationSuccess(response.data)) + closer() }).catch(error => { dispatch(saveUserProfileInformationFail(error)) }) 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/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) From 9ae186eb69b4c5eef86680986bbba0ded1b2303d Mon Sep 17 00:00:00 2001 From: Fosco Marotto Date: Sun, 22 Nov 2020 16:32:34 -0800 Subject: [PATCH 16/21] [paperclip] increase http read timeout --- config/initializers/paperclip.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, } ) From 854e510accdc27ab1a52e4151f746554c7b97c60 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Wed, 25 Nov 2020 16:02:08 -0600 Subject: [PATCH 17/21] Updated Gemfile.lock with bundle update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updated: - Gemfile.lock with bundle update --- Gemfile.lock | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index b565ad1a..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) + sidekiq (6.1.2) connection_pool (>= 2.2.2) - rack (>= 2.0.0) - rack-protection (>= 2.0.0) - redis (>= 4.1.0) + 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) From 99e5711c8b8406fdd3fefd1b222046d68925d1a7 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Wed, 25 Nov 2020 16:03:29 -0600 Subject: [PATCH 18/21] Added new cli commands in emoji, domains for removing remote content MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Added: - new cli commands in emoji, domains for removing remote content --- lib/gabsocial/domains_cli.rb | 24 ++++++++++++++++++++++++ lib/gabsocial/emoji_cli.rb | 4 ++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/lib/gabsocial/domains_cli.rb b/lib/gabsocial/domains_cli.rb index 231fd800..16ba5654 100644 --- a/lib/gabsocial/domains_cli.rb +++ b/lib/gabsocial/domains_cli.rb @@ -39,6 +39,30 @@ 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.limit(2).each do |domain| + say("Starting domain block for #{domain} #{dry_run}", :green) + + existing_domain_block = DomainBlock.find_by(domain: domain) + + unless existing_domain_block.present? + say("Domain 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("Domain block for #{domain} is already implemented #{dry_run}", :green) + end + end + + say('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] diff --git a/lib/gabsocial/emoji_cli.rb b/lib/gabsocial/emoji_cli.rb index 08991fc9..a2f0696d 100644 --- a/lib/gabsocial/emoji_cli.rb +++ b/lib/gabsocial/emoji_cli.rb @@ -66,9 +66,9 @@ module GabSocial say("Imported #{imported}, skipped #{skipped}, failed to import #{failed}", color(imported, skipped, failed)) end - desc 'purge', 'Remove all custom emoji' + desc 'purge', 'Remove all remote custom emoji' def purge - CustomEmoji.in_batches.destroy_all + CustomEmoji.remote.in_batches.destroy_all say('OK', :green) end From 61402a29a2c81e5a8400826854f1ca77a98e920b Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Wed, 25 Nov 2020 16:14:23 -0600 Subject: [PATCH 19/21] Updated domains cli remoteallremote command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updated: - domains cli remoteallremote command --- lib/gabsocial/domains_cli.rb | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lib/gabsocial/domains_cli.rb b/lib/gabsocial/domains_cli.rb index 16ba5654..7fa227cb 100644 --- a/lib/gabsocial/domains_cli.rb +++ b/lib/gabsocial/domains_cli.rb @@ -44,19 +44,23 @@ module GabSocial def deleteallremote dry_run = options[:dry_run] ? ' (DRY RUN)' : '' - Account.remote.by_domain_accounts.limit(2).each do |domain| + Account.remote.by_domain_accounts.each do |acct| + domain = acct.domain + say("Starting domain block for #{domain} #{dry_run}", :green) - existing_domain_block = DomainBlock.find_by(domain: domain) + if domain.present? + existing_domain_block = DomainBlock.find_by(domain: domain) - unless existing_domain_block.present? - say("Domain 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) + unless existing_domain_block.present? + say("Domain 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("Domain block for #{domain} is already implemented #{dry_run}", :green) end - else - say("Domain block for #{domain} is already implemented #{dry_run}", :green) end end From 8a041c1e2caf5b84959c5c505d77995c6612ccf8 Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Wed, 25 Nov 2020 16:19:26 -0600 Subject: [PATCH 20/21] Updated domains cli remoteallremote command logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updated: - domains cli remoteallremote command logging --- lib/gabsocial/domains_cli.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/gabsocial/domains_cli.rb b/lib/gabsocial/domains_cli.rb index 7fa227cb..c3640f21 100644 --- a/lib/gabsocial/domains_cli.rb +++ b/lib/gabsocial/domains_cli.rb @@ -47,24 +47,24 @@ module GabSocial Account.remote.by_domain_accounts.each do |acct| domain = acct.domain - say("Starting domain block for #{domain} #{dry_run}", :green) + 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("Domain block for #{domain} is starting #{dry_run}", :green) + 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("Domain block for #{domain} is already implemented #{dry_run}", :green) + say("\nDomain block for #{domain} is already implemented #{dry_run}", :red) end end end - say('Domain block deleteallremote done', :green) + say('\nDomain block deleteallremote done', :green) end option :concurrency, type: :numeric, default: 50, aliases: [:c] From a9387c5167ff18274e00afc95d82ea1f8d31ddcc Mon Sep 17 00:00:00 2001 From: mgabdev <> Date: Wed, 25 Nov 2020 16:26:53 -0600 Subject: [PATCH 21/21] Updated domains cli remoteallremote command batching MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Updated: - domains cli remoteallremote command batching --- lib/gabsocial/domains_cli.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gabsocial/domains_cli.rb b/lib/gabsocial/domains_cli.rb index c3640f21..8b1f4c47 100644 --- a/lib/gabsocial/domains_cli.rb +++ b/lib/gabsocial/domains_cli.rb @@ -44,7 +44,7 @@ module GabSocial def deleteallremote dry_run = options[:dry_run] ? ' (DRY RUN)' : '' - Account.remote.by_domain_accounts.each do |acct| + 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) @@ -64,7 +64,7 @@ module GabSocial end end - say('\nDomain block deleteallremote done', :green) + say('\n\n - Domain block deleteallremote done', :green) end option :concurrency, type: :numeric, default: 50, aliases: [:c]