diff options
author | Thibaut Girka <thib@sitedethib.com> | 2020-04-02 20:32:00 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2020-04-02 20:32:00 +0200 |
commit | f3eff922a3350b9c54ef6fd5f8804722fdbe4c9c (patch) | |
tree | 01c49b43b2b4349756d5ea43f2330fd08d323c4a /app | |
parent | a192b193bdf7013df09c6cd63916274cd9d47cf7 (diff) | |
parent | 69558d2fe5284d2b6168706bd7cbd8b7fb2b0847 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts: - `app/javascript/mastodon/features/compose/components/poll_form.js`: Upstream bumped poll option character limit, but we already had a higher one, kept ours. - `app/validators/poll_validator.rb`: Upstream bumped poll option character limit, but we already had a higher one, kept ours. - `config/initializers/content_security_policy.rb`: Upstream added a rule, the way we compute ours is different, but that added rule has been ported. - `package.json`: No real conflict, dependency update. Performed the same update. - `yarn.lock`: No real conflict, dependency update. Performed the same update.
Diffstat (limited to 'app')
51 files changed, 105 insertions, 202 deletions
diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 544e8e3c9..29ae91762 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -7,6 +7,7 @@ class Api::V1::StatusesController < Api::BaseController before_action -> { doorkeeper_authorize! :write, :'write:statuses' }, only: [:create, :destroy] before_action :require_user!, except: [:show, :context] before_action :set_status, only: [:show, :context] + before_action :set_thread, only: [:create] override_rate_limit_headers :create, family: :statuses @@ -36,7 +37,7 @@ class Api::V1::StatusesController < Api::BaseController def create @status = PostStatusService.new.call(current_user.account, text: status_params[:status], - thread: status_params[:in_reply_to_id].blank? ? nil : Status.find(status_params[:in_reply_to_id]), + thread: @thread, media_ids: status_params[:media_ids], sensitive: status_params[:sensitive], spoiler_text: status_params[:spoiler_text], @@ -70,6 +71,12 @@ class Api::V1::StatusesController < Api::BaseController raise ActiveRecord::RecordNotFound end + def set_thread + @thread = status_params[:in_reply_to_id].blank? ? nil : Status.find(status_params[:in_reply_to_id]) + rescue ActiveRecord::RecordNotFound + render json: { error: I18n.t('statuses.errors.in_reply_not_found') }, status: 404 + end + def status_params params.permit( :status, diff --git a/app/controllers/settings/imports_controller.rb b/app/controllers/settings/imports_controller.rb index 38f2e39c1..7b8c4ae23 100644 --- a/app/controllers/settings/imports_controller.rb +++ b/app/controllers/settings/imports_controller.rb @@ -29,6 +29,6 @@ class Settings::ImportsController < Settings::BaseController end def import_params - params.require(:import).permit(:data, :type) + params.require(:import).permit(:data, :type, :mode) end end diff --git a/app/javascript/mastodon/actions/accounts.js b/app/javascript/mastodon/actions/accounts.js index 4af36e998..cb2c682a4 100644 --- a/app/javascript/mastodon/actions/accounts.js +++ b/app/javascript/mastodon/actions/accounts.js @@ -396,6 +396,7 @@ export function fetchFollowersFail(id, error) { type: FOLLOWERS_FETCH_FAIL, id, error, + skipNotFound: true, }; }; @@ -482,6 +483,7 @@ export function fetchFollowingFail(id, error) { type: FOLLOWING_FETCH_FAIL, id, error, + skipNotFound: true, }; }; @@ -571,6 +573,7 @@ export function fetchRelationshipsFail(error) { type: RELATIONSHIPS_FETCH_FAIL, error, skipLoading: true, + skipNotFound: true, }; }; diff --git a/app/javascript/mastodon/actions/alerts.js b/app/javascript/mastodon/actions/alerts.js index cd36d8007..1670f9c10 100644 --- a/app/javascript/mastodon/actions/alerts.js +++ b/app/javascript/mastodon/actions/alerts.js @@ -34,11 +34,11 @@ export function showAlert(title = messages.unexpectedTitle, message = messages.u }; }; -export function showAlertForError(error) { +export function showAlertForError(error, skipNotFound = false) { if (error.response) { const { data, status, statusText, headers } = error.response; - if (status === 404 || status === 410) { + if (skipNotFound && (status === 404 || status === 410)) { // Skip these errors as they are reflected in the UI return { type: ALERT_NOOP }; } diff --git a/app/javascript/mastodon/actions/identity_proofs.js b/app/javascript/mastodon/actions/identity_proofs.js index 449debf61..103983956 100644 --- a/app/javascript/mastodon/actions/identity_proofs.js +++ b/app/javascript/mastodon/actions/identity_proofs.js @@ -27,4 +27,5 @@ export const fetchAccountIdentityProofsFail = (accountId, err) => ({ type: IDENTITY_PROOFS_ACCOUNT_FETCH_FAIL, accountId, err, + skipNotFound: true, }); diff --git a/app/javascript/mastodon/actions/timelines.js b/app/javascript/mastodon/actions/timelines.js index 054668655..cdd2111f8 100644 --- a/app/javascript/mastodon/actions/timelines.js +++ b/app/javascript/mastodon/actions/timelines.js @@ -149,6 +149,7 @@ export function expandTimelineFail(timeline, error, isLoadingMore) { timeline, error, skipLoading: !isLoadingMore, + skipNotFound: timeline.startsWith('account:'), }; }; diff --git a/app/javascript/mastodon/components/column_header.js b/app/javascript/mastodon/components/column_header.js index ea82f9ef9..1bb583583 100644 --- a/app/javascript/mastodon/components/column_header.js +++ b/app/javascript/mastodon/components/column_header.js @@ -76,8 +76,9 @@ class ColumnHeader extends React.PureComponent { handlePin = () => { if (!this.props.pinned) { - this.historyBack(); + this.context.router.history.replace('/'); } + this.props.onPin(); } diff --git a/app/javascript/mastodon/components/poll.js b/app/javascript/mastodon/components/poll.js index 3a17e80e7..7525a1030 100644 --- a/app/javascript/mastodon/components/poll.js +++ b/app/javascript/mastodon/components/poll.js @@ -127,15 +127,7 @@ class Poll extends ImmutablePureComponent { return ( <li key={option.get('title')}> - {showResults && ( - <Motion defaultStyle={{ width: 0 }} style={{ width: spring(percent, { stiffness: 180, damping: 12 }) }}> - {({ width }) => - <span className={classNames('poll__chart', { leading })} style={{ width: `${width}%` }} /> - } - </Motion> - )} - - <label className={classNames('poll__text', { selectable: !showResults })}> + <label className={classNames('poll__option', { selectable: !showResults })}> <input name='vote-options' type={poll.get('multiple') ? 'checkbox' : 'radio'} @@ -157,12 +149,26 @@ class Poll extends ImmutablePureComponent { /> )} {showResults && <span className='poll__number'> - {!!voted && <Icon id='check' className='poll__vote__mark' title={intl.formatMessage(messages.voted)} />} {Math.round(percent)}% </span>} - <span dangerouslySetInnerHTML={{ __html: titleEmojified }} /> + <span + className='poll__option__text' + dangerouslySetInnerHTML={{ __html: titleEmojified }} + /> + + {!!voted && <span className='poll__voted'> + <Icon id='check' className='poll__voted__mark' title={intl.formatMessage(messages.voted)} /> + </span>} </label> + + {showResults && ( + <Motion defaultStyle={{ width: 0 }} style={{ width: spring(percent, { stiffness: 180, damping: 12 }) }}> + {({ width }) => + <span className={classNames('poll__chart', { leading })} style={{ width: `${width}%` }} /> + } + </Motion> + )} </li> ); } diff --git a/app/javascript/mastodon/components/status.js b/app/javascript/mastodon/components/status.js index 0dc00cb98..075ee1b87 100644 --- a/app/javascript/mastodon/components/status.js +++ b/app/javascript/mastodon/components/status.js @@ -432,16 +432,10 @@ class Status extends ImmutablePureComponent { </a> </div> - <StatusContent status={status} onClick={this.handleClick} expanded={!status.get('hidden')} onExpandedToggle={this.handleExpandedToggle} collapsable onCollapsedToggle={this.handleCollapsedToggle} /> + <StatusContent status={status} onClick={this.handleClick} expanded={!status.get('hidden')} showThread={showThread} onExpandedToggle={this.handleExpandedToggle} collapsable onCollapsedToggle={this.handleCollapsedToggle} /> {media} - {showThread && status.get('in_reply_to_id') && status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) && ( - <button className='status__content__read-more-button' onClick={this.handleClick}> - <FormattedMessage id='status.show_thread' defaultMessage='Show thread' /> - </button> - )} - <StatusActionBar status={status} account={account} {...other} /> </div> </div> diff --git a/app/javascript/mastodon/components/status_content.js b/app/javascript/mastodon/components/status_content.js index 5d921fd41..3200f2d82 100644 --- a/app/javascript/mastodon/components/status_content.js +++ b/app/javascript/mastodon/components/status_content.js @@ -20,6 +20,7 @@ export default class StatusContent extends React.PureComponent { static propTypes = { status: ImmutablePropTypes.map.isRequired, expanded: PropTypes.bool, + showThread: PropTypes.bool, onExpandedToggle: PropTypes.func, onClick: PropTypes.func, collapsable: PropTypes.bool, @@ -181,6 +182,7 @@ export default class StatusContent extends React.PureComponent { const hidden = this.props.onExpandedToggle ? !this.props.expanded : this.state.hidden; const renderReadMore = this.props.onClick && status.get('collapsed'); + const renderViewThread = this.props.showThread && status.get('in_reply_to_id') && status.get('in_reply_to_account_id') === status.getIn(['account', 'id']); const content = { __html: status.get('contentHtml') }; const spoilerContent = { __html: status.get('spoilerHtml') }; @@ -195,6 +197,12 @@ export default class StatusContent extends React.PureComponent { directionStyle.direction = 'rtl'; } + const showThreadButton = ( + <button className='status__content__read-more-button' onClick={this.props.onClick}> + <FormattedMessage id='status.show_thread' defaultMessage='Show thread' /> + </button> + ); + const readMoreButton = ( <button className='status__content__read-more-button' onClick={this.props.onClick} key='read-more'> <FormattedMessage id='status.read_more' defaultMessage='Read more' /><Icon id='angle-right' fixedWidth /> @@ -229,6 +237,8 @@ export default class StatusContent extends React.PureComponent { <div tabIndex={!hidden ? 0 : null} className={`status__content__text ${!hidden ? 'status__content__text--visible' : ''}`} style={directionStyle} dangerouslySetInnerHTML={content} /> {!hidden && !!status.get('poll') && <PollContainer pollId={status.get('poll')} />} + + {renderViewThread && showThreadButton} </div> ); } else if (this.props.onClick) { @@ -237,6 +247,8 @@ export default class StatusContent extends React.PureComponent { <div className='status__content__text status__content__text--visible' style={directionStyle} dangerouslySetInnerHTML={content} /> {!!status.get('poll') && <PollContainer pollId={status.get('poll')} />} + + {renderViewThread && showThreadButton} </div>, ]; @@ -251,6 +263,8 @@ export default class StatusContent extends React.PureComponent { <div className='status__content__text status__content__text--visible' style={directionStyle} dangerouslySetInnerHTML={content} /> {!!status.get('poll') && <PollContainer pollId={status.get('poll')} />} + + {renderViewThread && showThreadButton} </div> ); } diff --git a/app/javascript/mastodon/features/compose/components/poll_form.js b/app/javascript/mastodon/features/compose/components/poll_form.js index cc740def2..271019dfe 100644 --- a/app/javascript/mastodon/features/compose/components/poll_form.js +++ b/app/javascript/mastodon/features/compose/components/poll_form.js @@ -75,7 +75,7 @@ class Option extends React.PureComponent { return ( <li> - <label className='poll__text editable'> + <label className='poll__option editable'> <span className={classNames('poll__input', { checkbox: isPollMultiple })} onClick={this.handleToggleMultiple} diff --git a/app/javascript/mastodon/features/direct_timeline/components/conversation.js b/app/javascript/mastodon/features/direct_timeline/components/conversation.js index 235cb7ad8..f9e45067f 100644 --- a/app/javascript/mastodon/features/direct_timeline/components/conversation.js +++ b/app/javascript/mastodon/features/direct_timeline/components/conversation.js @@ -160,7 +160,7 @@ class Conversation extends ImmutablePureComponent { return ( <HotKeys handlers={handlers}> <div className={classNames('conversation focusable muted', { 'conversation--unread': unread })} tabIndex='0'> - <div className='conversation__avatar'> + <div className='conversation__avatar' onClick={this.handleClick} role='presentation'> <AvatarComposite accounts={accounts} size={48} /> </div> diff --git a/app/javascript/mastodon/middleware/errors.js b/app/javascript/mastodon/middleware/errors.js index 3cebb42e0..0a65fd321 100644 --- a/app/javascript/mastodon/middleware/errors.js +++ b/app/javascript/mastodon/middleware/errors.js @@ -8,7 +8,7 @@ export default function errorsMiddleware() { const isFail = new RegExp(`${defaultFailSuffix}$`, 'g'); if (action.type.match(isFail)) { - dispatch(showAlertForError(action.error)); + dispatch(showAlertForError(action.error, action.skipNotFound)); } } diff --git a/app/javascript/mastodon/reducers/compose.js b/app/javascript/mastodon/reducers/compose.js index c6653fe4c..e6e6d2ae1 100644 --- a/app/javascript/mastodon/reducers/compose.js +++ b/app/javascript/mastodon/reducers/compose.js @@ -261,7 +261,6 @@ export default function compose(state = initialState, action) { }); case COMPOSE_SPOILERNESS_CHANGE: return state.withMutations(map => { - map.set('spoiler_text', ''); map.set('spoiler', !state.get('spoiler')); map.set('idempotencyKey', uuid()); diff --git a/app/javascript/styles/mastodon-light/diff.scss b/app/javascript/styles/mastodon-light/diff.scss index 05e52966b..7a846bcc6 100644 --- a/app/javascript/styles/mastodon-light/diff.scss +++ b/app/javascript/styles/mastodon-light/diff.scss @@ -142,7 +142,7 @@ html { } .compose-form__autosuggest-wrapper, -.poll__text input[type="text"], +.poll__option input[type="text"], .compose-form .spoiler-input__input, .compose-form__poll-wrapper select, .search__input, diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 143384d9e..aea2ae6cb 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -1028,13 +1028,11 @@ } .display-name { + color: $light-text-color; + strong { color: $inverted-text-color; } - - span { - color: $light-text-color; - } } .status__content { @@ -1333,7 +1331,6 @@ border-radius: 50%; overflow: hidden; position: relative; - cursor: default; & > div { float: left; @@ -6570,6 +6567,7 @@ noscript { padding: 10px; padding-top: 12px; position: relative; + cursor: pointer; } &__unread { diff --git a/app/javascript/styles/mastodon/polls.scss b/app/javascript/styles/mastodon/polls.scss index 4e34813ed..1ecc8434d 100644 --- a/app/javascript/styles/mastodon/polls.scss +++ b/app/javascript/styles/mastodon/polls.scss @@ -8,20 +8,18 @@ } &__chart { - position: absolute; - top: 0; - left: 0; - height: 100%; - display: inline-block; border-radius: 4px; - background: darken($ui-primary-color, 14%); + display: block; + background: darken($ui-primary-color, 5%); + height: 5px; + min-width: 1%; &.leading { background: $ui-highlight-color; } } - &__text { + &__option { position: relative; display: flex; padding: 6px 0; @@ -29,6 +27,13 @@ cursor: default; overflow: hidden; + &__text { + display: inline-block; + word-wrap: break-word; + overflow-wrap: break-word; + max-width: calc(100% - 45px - 25px); + } + input[type=radio], input[type=checkbox] { display: none; @@ -112,19 +117,18 @@ &__number { display: inline-block; - width: 52px; + width: 45px; font-weight: 700; - padding: 0 10px; - padding-left: 8px; - text-align: right; - margin-top: auto; - margin-bottom: auto; - flex: 0 0 52px; + flex: 0 0 45px; } - &__vote__mark { - float: left; - line-height: 18px; + &__voted { + padding: 0 5px; + display: inline-block; + + &__mark { + font-size: 18px; + } } &__footer { @@ -199,7 +203,7 @@ display: flex; align-items: center; - .poll__text { + .poll__option { flex: 0 0 auto; width: calc(100% - (23px + 6px)); margin-right: 6px; diff --git a/app/services/import_service.rb b/app/services/import_service.rb index 4ee431ea3..c0d741d57 100644 --- a/app/services/import_service.rb +++ b/app/services/import_service.rb @@ -64,7 +64,8 @@ class ImportService < BaseService end def import_relationships!(action, undo_action, overwrite_scope, limit, extra_fields = {}) - items = @data.take(limit).map { |row| [row['Account address']&.strip, Hash[extra_fields.map { |key, header| [key, row[header]&.strip] }]] }.reject { |(id, _)| id.blank? } + local_domain_suffix = "@#{Rails.configuration.x.local_domain}" + items = @data.take(limit).map { |row| [row['Account address']&.strip&.delete_suffix(local_domain_suffix), Hash[extra_fields.map { |key, header| [key, row[header]&.strip] }]] }.reject { |(id, _)| id.blank? } if @import.overwrite? presence_hash = items.each_with_object({}) { |(id, extra), mapping| mapping[id] = [true, extra] } diff --git a/app/services/search_service.rb b/app/services/search_service.rb index 090fd409b..830de4de3 100644 --- a/app/services/search_service.rb +++ b/app/services/search_service.rb @@ -10,10 +10,10 @@ class SearchService < BaseService @resolve = options[:resolve] || false default_results.tap do |results| - next if @query.blank? + next if @query.blank? || @limit.zero? if url_query? - results.merge!(url_resource_results) unless url_resource.nil? || (@options[:type].present? && url_resource_symbol != @options[:type].to_sym) + results.merge!(url_resource_results) unless url_resource.nil? || @offset.positive? || (@options[:type].present? && url_resource_symbol != @options[:type].to_sym) elsif @query.present? results[:accounts] = perform_accounts_search! if account_searchable? results[:statuses] = perform_statuses_search! if full_text_searchable? diff --git a/app/views/statuses/_poll.html.haml b/app/views/statuses/_poll.html.haml index d1aba6ef9..c17476657 100644 --- a/app/views/statuses/_poll.html.haml +++ b/app/views/statuses/_poll.html.haml @@ -8,16 +8,16 @@ %li - if show_results - percent = total_votes_count > 0 ? 100 * option.votes_count / total_votes_count : 0 - %span.poll__chart{ style: "width: #{percent}%" } - - %label.poll__text>< + %label.poll__option>< %span.poll__number>< - if own_votes.include?(index) - %i.poll__vote__mark.fa.fa-check + %i.poll__voted__mark.fa.fa-check = percent.round = Formatter.instance.format_poll_option(status, option, autoplay: autoplay) + + %span.poll__chart{ style: "width: #{percent}%" } - else - %label.poll__text>< + %label.poll__option>< %span.poll__input{ class: poll.multiple? ? 'checkbox' : nil}>< = Formatter.instance.format_poll_option(status, option, autoplay: autoplay) .poll__footer diff --git a/app/workers/activitypub/distribute_poll_update_worker.rb b/app/workers/activitypub/distribute_poll_update_worker.rb index 37a13db2b..601075ea6 100644 --- a/app/workers/activitypub/distribute_poll_update_worker.rb +++ b/app/workers/activitypub/distribute_poll_update_worker.rb @@ -4,7 +4,7 @@ class ActivityPub::DistributePollUpdateWorker include Sidekiq::Worker include Payloadable - sidekiq_options queue: 'push', unique: :until_executed, retry: 0 + sidekiq_options queue: 'push', lock: :until_executed, retry: 0 def perform(status_id) @status = Status.find(status_id) diff --git a/app/workers/activitypub/synchronize_featured_collection_worker.rb b/app/workers/activitypub/synchronize_featured_collection_worker.rb index 7b16d3426..7a0898e89 100644 --- a/app/workers/activitypub/synchronize_featured_collection_worker.rb +++ b/app/workers/activitypub/synchronize_featured_collection_worker.rb @@ -3,7 +3,7 @@ class ActivityPub::SynchronizeFeaturedCollectionWorker include Sidekiq::Worker - sidekiq_options queue: 'pull', unique: :until_executed + sidekiq_options queue: 'pull', lock: :until_executed def perform(account_id) ActivityPub::FetchFeaturedCollectionService.new.call(Account.find(account_id)) diff --git a/app/workers/after_remote_follow_request_worker.rb b/app/workers/after_remote_follow_request_worker.rb deleted file mode 100644 index ce9c65834..000000000 --- a/app/workers/after_remote_follow_request_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AfterRemoteFollowRequestWorker - include Sidekiq::Worker - - sidekiq_options queue: 'pull', retry: 5 - - def perform(follow_request_id); end -end diff --git a/app/workers/after_remote_follow_worker.rb b/app/workers/after_remote_follow_worker.rb deleted file mode 100644 index d9719f2bf..000000000 --- a/app/workers/after_remote_follow_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AfterRemoteFollowWorker - include Sidekiq::Worker - - sidekiq_options queue: 'pull', retry: 5 - - def perform(follow_id); end -end diff --git a/app/workers/notification_worker.rb b/app/workers/notification_worker.rb deleted file mode 100644 index 1c0f001cf..000000000 --- a/app/workers/notification_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class NotificationWorker - include Sidekiq::Worker - - sidekiq_options queue: 'push', retry: 5 - - def perform(xml, source_account_id, target_account_id); end -end diff --git a/app/workers/poll_expiration_notify_worker.rb b/app/workers/poll_expiration_notify_worker.rb index e08f0c249..64b4cbd7e 100644 --- a/app/workers/poll_expiration_notify_worker.rb +++ b/app/workers/poll_expiration_notify_worker.rb @@ -3,7 +3,7 @@ class PollExpirationNotifyWorker include Sidekiq::Worker - sidekiq_options unique: :until_executed + sidekiq_options lock: :until_executed def perform(poll_id) poll = Poll.find(poll_id) diff --git a/app/workers/processing_worker.rb b/app/workers/processing_worker.rb deleted file mode 100644 index cf3bd8397..000000000 --- a/app/workers/processing_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class ProcessingWorker - include Sidekiq::Worker - - sidekiq_options backtrace: true - - def perform(account_id, body); end -end diff --git a/app/workers/publish_scheduled_status_worker.rb b/app/workers/publish_scheduled_status_worker.rb index 850610c4e..ce42f7be7 100644 --- a/app/workers/publish_scheduled_status_worker.rb +++ b/app/workers/publish_scheduled_status_worker.rb @@ -3,7 +3,7 @@ class PublishScheduledStatusWorker include Sidekiq::Worker - sidekiq_options unique: :until_executed + sidekiq_options lock: :until_executed def perform(scheduled_status_id) scheduled_status = ScheduledStatus.find(scheduled_status_id) diff --git a/app/workers/pubsubhubbub/confirmation_worker.rb b/app/workers/pubsubhubbub/confirmation_worker.rb deleted file mode 100644 index 783a8c95f..000000000 --- a/app/workers/pubsubhubbub/confirmation_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class Pubsubhubbub::ConfirmationWorker - include Sidekiq::Worker - - sidekiq_options queue: 'push', retry: false - - def perform(subscription_id, mode, secret = nil, lease_seconds = nil); end -end diff --git a/app/workers/pubsubhubbub/delivery_worker.rb b/app/workers/pubsubhubbub/delivery_worker.rb deleted file mode 100644 index 1260060bd..000000000 --- a/app/workers/pubsubhubbub/delivery_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class Pubsubhubbub::DeliveryWorker - include Sidekiq::Worker - - sidekiq_options queue: 'push', retry: 3, dead: false - - def perform(subscription_id, payload); end -end diff --git a/app/workers/pubsubhubbub/distribution_worker.rb b/app/workers/pubsubhubbub/distribution_worker.rb deleted file mode 100644 index 75bac5d6f..000000000 --- a/app/workers/pubsubhubbub/distribution_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class Pubsubhubbub::DistributionWorker - include Sidekiq::Worker - - sidekiq_options queue: 'push' - - def perform(stream_entry_ids); end -end diff --git a/app/workers/pubsubhubbub/raw_distribution_worker.rb b/app/workers/pubsubhubbub/raw_distribution_worker.rb deleted file mode 100644 index ece9c80ac..000000000 --- a/app/workers/pubsubhubbub/raw_distribution_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class Pubsubhubbub::RawDistributionWorker - include Sidekiq::Worker - - sidekiq_options queue: 'push' - - def perform(xml, source_account_id); end -end diff --git a/app/workers/pubsubhubbub/subscribe_worker.rb b/app/workers/pubsubhubbub/subscribe_worker.rb deleted file mode 100644 index b861b5e67..000000000 --- a/app/workers/pubsubhubbub/subscribe_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class Pubsubhubbub::SubscribeWorker - include Sidekiq::Worker - - sidekiq_options queue: 'push', retry: 10, unique: :until_executed, dead: false - - def perform(account_id); end -end diff --git a/app/workers/pubsubhubbub/unsubscribe_worker.rb b/app/workers/pubsubhubbub/unsubscribe_worker.rb deleted file mode 100644 index 0c1c263f6..000000000 --- a/app/workers/pubsubhubbub/unsubscribe_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class Pubsubhubbub::UnsubscribeWorker - include Sidekiq::Worker - - sidekiq_options queue: 'push', retry: false, unique: :until_executed, dead: false - - def perform(account_id); end -end diff --git a/app/workers/regeneration_worker.rb b/app/workers/regeneration_worker.rb index 5c6a040bd..5c13c894f 100644 --- a/app/workers/regeneration_worker.rb +++ b/app/workers/regeneration_worker.rb @@ -3,7 +3,7 @@ class RegenerationWorker include Sidekiq::Worker - sidekiq_options unique: :until_executed + sidekiq_options lock: :until_executed def perform(account_id, _ = :home) account = Account.find(account_id) diff --git a/app/workers/remote_profile_update_worker.rb b/app/workers/remote_profile_update_worker.rb deleted file mode 100644 index 01e8daf8f..000000000 --- a/app/workers/remote_profile_update_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class RemoteProfileUpdateWorker - include Sidekiq::Worker - - sidekiq_options queue: 'pull' - - def perform(account_id, body, resubscribe); end -end diff --git a/app/workers/resolve_account_worker.rb b/app/workers/resolve_account_worker.rb index cd7c4d7dd..2b5be6d1b 100644 --- a/app/workers/resolve_account_worker.rb +++ b/app/workers/resolve_account_worker.rb @@ -3,7 +3,7 @@ class ResolveAccountWorker include Sidekiq::Worker - sidekiq_options queue: 'pull', unique: :until_executed + sidekiq_options queue: 'pull', lock: :until_executed def perform(uri) ResolveAccountService.new.call(uri) diff --git a/app/workers/salmon_worker.rb b/app/workers/salmon_worker.rb deleted file mode 100644 index 10200b06c..000000000 --- a/app/workers/salmon_worker.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class SalmonWorker - include Sidekiq::Worker - - sidekiq_options backtrace: true - - def perform(account_id, body); end -end diff --git a/app/workers/scheduler/backup_cleanup_scheduler.rb b/app/workers/scheduler/backup_cleanup_scheduler.rb index d43660699..d69ca2556 100644 --- a/app/workers/scheduler/backup_cleanup_scheduler.rb +++ b/app/workers/scheduler/backup_cleanup_scheduler.rb @@ -3,7 +3,7 @@ class Scheduler::BackupCleanupScheduler include Sidekiq::Worker - sidekiq_options unique: :until_executed, retry: 0 + sidekiq_options lock: :until_executed, retry: 0 def perform old_backups.reorder(nil).find_each(&:destroy!) diff --git a/app/workers/scheduler/doorkeeper_cleanup_scheduler.rb b/app/workers/scheduler/doorkeeper_cleanup_scheduler.rb index e5e5f6bc4..94788a85b 100644 --- a/app/workers/scheduler/doorkeeper_cleanup_scheduler.rb +++ b/app/workers/scheduler/doorkeeper_cleanup_scheduler.rb @@ -3,7 +3,7 @@ class Scheduler::DoorkeeperCleanupScheduler include Sidekiq::Worker - sidekiq_options unique: :until_executed, retry: 0 + sidekiq_options lock: :until_executed, retry: 0 def perform Doorkeeper::AccessToken.where('revoked_at IS NOT NULL').where('revoked_at < NOW()').delete_all diff --git a/app/workers/scheduler/email_scheduler.rb b/app/workers/scheduler/email_scheduler.rb index 1eeeee412..9a7355524 100644 --- a/app/workers/scheduler/email_scheduler.rb +++ b/app/workers/scheduler/email_scheduler.rb @@ -3,7 +3,7 @@ class Scheduler::EmailScheduler include Sidekiq::Worker - sidekiq_options unique: :until_executed, retry: 0 + sidekiq_options lock: :until_executed, retry: 0 FREQUENCY = 7.days.freeze SIGN_IN_OFFSET = 1.day.freeze diff --git a/app/workers/scheduler/feed_cleanup_scheduler.rb b/app/workers/scheduler/feed_cleanup_scheduler.rb index 4933f1753..99e3440fe 100644 --- a/app/workers/scheduler/feed_cleanup_scheduler.rb +++ b/app/workers/scheduler/feed_cleanup_scheduler.rb @@ -4,7 +4,7 @@ class Scheduler::FeedCleanupScheduler include Sidekiq::Worker include Redisable - sidekiq_options unique: :until_executed, retry: 0 + sidekiq_options lock: :until_executed, retry: 0 def perform clean_home_feeds! diff --git a/app/workers/scheduler/ip_cleanup_scheduler.rb b/app/workers/scheduler/ip_cleanup_scheduler.rb index 4f44078d8..6d38b52a2 100644 --- a/app/workers/scheduler/ip_cleanup_scheduler.rb +++ b/app/workers/scheduler/ip_cleanup_scheduler.rb @@ -5,7 +5,7 @@ class Scheduler::IpCleanupScheduler RETENTION_PERIOD = 1.year - sidekiq_options unique: :until_executed, retry: 0 + sidekiq_options lock: :until_executed, retry: 0 def perform time_ago = RETENTION_PERIOD.ago diff --git a/app/workers/scheduler/media_cleanup_scheduler.rb b/app/workers/scheduler/media_cleanup_scheduler.rb index fb01aa70c..671ebf6e0 100644 --- a/app/workers/scheduler/media_cleanup_scheduler.rb +++ b/app/workers/scheduler/media_cleanup_scheduler.rb @@ -3,7 +3,7 @@ class Scheduler::MediaCleanupScheduler include Sidekiq::Worker - sidekiq_options unique: :until_executed, retry: 0 + sidekiq_options lock: :until_executed, retry: 0 def perform unattached_media.find_each(&:destroy) diff --git a/app/workers/scheduler/pghero_scheduler.rb b/app/workers/scheduler/pghero_scheduler.rb index 4453bf2cd..cf5570048 100644 --- a/app/workers/scheduler/pghero_scheduler.rb +++ b/app/workers/scheduler/pghero_scheduler.rb @@ -3,7 +3,7 @@ class Scheduler::PgheroScheduler include Sidekiq::Worker - sidekiq_options unique: :until_executed, retry: 0 + sidekiq_options lock: :until_executed, retry: 0 def perform PgHero.capture_space_stats diff --git a/app/workers/scheduler/scheduled_statuses_scheduler.rb b/app/workers/scheduler/scheduled_statuses_scheduler.rb index 9cfe949de..25df3c07d 100644 --- a/app/workers/scheduler/scheduled_statuses_scheduler.rb +++ b/app/workers/scheduler/scheduled_statuses_scheduler.rb @@ -3,7 +3,7 @@ class Scheduler::ScheduledStatusesScheduler include Sidekiq::Worker - sidekiq_options unique: :until_executed, retry: 0 + sidekiq_options lock: :until_executed, retry: 0 def perform publish_scheduled_statuses! diff --git a/app/workers/scheduler/subscriptions_cleanup_scheduler.rb b/app/workers/scheduler/subscriptions_cleanup_scheduler.rb deleted file mode 100644 index 75fe681a9..000000000 --- a/app/workers/scheduler/subscriptions_cleanup_scheduler.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class Scheduler::SubscriptionsCleanupScheduler - include Sidekiq::Worker - - sidekiq_options unique: :until_executed, retry: 0 - - def perform; end -end diff --git a/app/workers/scheduler/subscriptions_scheduler.rb b/app/workers/scheduler/subscriptions_scheduler.rb deleted file mode 100644 index 6903cadc7..000000000 --- a/app/workers/scheduler/subscriptions_scheduler.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class Scheduler::SubscriptionsScheduler - include Sidekiq::Worker - - sidekiq_options unique: :until_executed, retry: 0 - - def perform; end -end diff --git a/app/workers/scheduler/trending_tags_scheduler.rb b/app/workers/scheduler/trending_tags_scheduler.rb index 77f0d5747..e9891424e 100644 --- a/app/workers/scheduler/trending_tags_scheduler.rb +++ b/app/workers/scheduler/trending_tags_scheduler.rb @@ -3,7 +3,7 @@ class Scheduler::TrendingTagsScheduler include Sidekiq::Worker - sidekiq_options unique: :until_executed, retry: 0 + sidekiq_options lock: :until_executed, retry: 0 def perform TrendingTags.update! if Setting.trends diff --git a/app/workers/scheduler/user_cleanup_scheduler.rb b/app/workers/scheduler/user_cleanup_scheduler.rb index 881b911be..6113edde1 100644 --- a/app/workers/scheduler/user_cleanup_scheduler.rb +++ b/app/workers/scheduler/user_cleanup_scheduler.rb @@ -3,7 +3,7 @@ class Scheduler::UserCleanupScheduler include Sidekiq::Worker - sidekiq_options unique: :until_executed, retry: 0 + sidekiq_options lock: :until_executed, retry: 0 def perform User.where('confirmed_at is NULL AND confirmation_sent_at <= ?', 2.days.ago).reorder(nil).find_in_batches do |batch| diff --git a/app/workers/verify_account_links_worker.rb b/app/workers/verify_account_links_worker.rb index 901498583..8114d59be 100644 --- a/app/workers/verify_account_links_worker.rb +++ b/app/workers/verify_account_links_worker.rb @@ -3,7 +3,7 @@ class VerifyAccountLinksWorker include Sidekiq::Worker - sidekiq_options queue: 'pull', retry: false, unique: :until_executed + sidekiq_options queue: 'pull', retry: false, lock: :until_executed def perform(account_id) account = Account.find(account_id) |