From 4daecf36f5a6e5024b9a96e8cc2ebe24f522c72d Mon Sep 17 00:00:00 2001 From: claustra01 <108509532+claustra01@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:05:52 +0900 Subject: [PATCH] Revert "Version up to 4.2.12" --- .github/workflows/pr-auto-approve.yml | 27 ------------ CHANGELOG.md | 39 ------------------ Gemfile.lock | 6 +-- app/javascript/mastodon/actions/settings.js | 2 +- .../components/admin/ReportReasonSelector.jsx | 2 +- .../mastodon/components/dropdown_menu.jsx | 1 - .../features/compose/components/search.jsx | 11 ++--- .../ui/components/focal_point_modal.jsx | 2 +- app/javascript/mastodon/locales/en.json | 1 - app/lib/activitypub/activity/create.rb | 4 +- app/lib/activitypub/adapter.rb | 2 +- app/lib/video_metadata_extractor.rb | 10 +---- app/lib/webfinger.rb | 17 +------- app/models/account.rb | 2 +- app/models/concerns/ldap_authenticable.rb | 2 +- app/models/report.rb | 6 ++- app/models/tag.rb | 2 +- .../fetch_featured_collection_service.rb | 2 - .../activitypub/fetch_remote_actor_service.rb | 5 ++- .../process_status_update_service.rb | 4 +- app/services/backup_service.rb | 6 +-- app/services/notify_service.rb | 3 +- app/services/resolve_account_service.rb | 8 +++- app/views/admin/custom_emojis/new.html.haml | 2 +- config/initializers/rack_attack.rb | 2 +- db/seeds/04_admin.rb | 4 +- docker-compose.yml | 6 +-- lib/mastodon/cli/media.rb | 1 - lib/mastodon/version.rb | 2 +- lib/sanitize_ext/sanitize_config.rb | 2 +- lib/tasks/statistics.rake | 4 +- .../requests/activitypub-webfinger.txt | 2 +- spec/fixtures/requests/webfinger.txt | 2 +- spec/lib/activitypub/adapter_spec.rb | 10 ++--- spec/lib/webfinger_spec.rb | 41 ------------------- spec/models/account_spec.rb | 8 ---- spec/models/report_spec.rb | 13 ------ spec/models/tag_spec.rb | 12 ------ .../fetch_featured_collection_service_spec.rb | 11 ----- .../fetch_remote_account_service_spec.rb | 10 ++--- .../fetch_remote_actor_service_spec.rb | 10 ++--- .../fetch_remote_key_service_spec.rb | 2 +- .../process_account_service_spec.rb | 2 +- spec/services/backup_service_spec.rb | 1 - spec/services/notify_service_spec.rb | 11 ----- 45 files changed, 66 insertions(+), 256 deletions(-) delete mode 100644 .github/workflows/pr-auto-approve.yml delete mode 100644 spec/lib/webfinger_spec.rb diff --git a/.github/workflows/pr-auto-approve.yml b/.github/workflows/pr-auto-approve.yml deleted file mode 100644 index e46af2d48e86d2..00000000000000 --- a/.github/workflows/pr-auto-approve.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Auto Approve -# このGitHub Actionsを起動するイベントの種類 -on: - # Pull Request関係のイベント - pull_request: - types: - - opened - - reopened - - synchronize - - ready_for_review # Draft Pull RequestからDraftが外れたら起動 -jobs: - approve: - # このJobを実行する条件。以下の全てを満たす場合 - # + Pull Requestの作成者が、リポジトリ所有者と等しい - # + Pull Requestが、Draft Pull Requestではない - if: | - github.event.pull_request.user.login == github.repository_owner - && ! github.event.pull_request.draft - # このJobを実行する時に使うOS - # 今回は何でもいいが、GitHub Actionsでは指定が必須 - runs-on: ubuntu-latest - # 内部で使用されるGitHub APIの権限を上書き - permissions: - pull-requests: write - steps: - # Pull RequestをApproveする - - uses: hmarr/auto-approve-action@v3 diff --git a/CHANGELOG.md b/CHANGELOG.md index b2229f9fdcbfa7..e57d5f23b092d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,45 +2,6 @@ All notable changes to this project will be documented in this file. -## [4.2.12] - 2024-08-19 - -### Fixed - -- Fix broken notifications for mentions from local moderators ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/31484)) - -## [4.2.11] - 2024-08-16 - -### Added - -- Add support for incoming `` tag ([mediaformat](https://github.com/mastodon/mastodon/pull/31375)) - -### Changed - -- Change logic of block/mute bypass for mentions from moderators to only apply to visible roles with moderation powers ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/31271)) - -### Fixed - -- Fix incorrect rate limit on PUT requests ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/31356)) -- Fix presence of `ß` in adjacent word preventing mention and hashtag matching ([adamniedzielski](https://github.com/mastodon/mastodon/pull/31122)) -- Fix processing of webfinger responses with multiple `self` links ([adamniedzielski](https://github.com/mastodon/mastodon/pull/31110)) -- Fix duplicate `orderedItems` in user archive's `outbox.json` ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/31099)) -- Fix click event handling when clicking outside of an open dropdown menu ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/31251)) -- Fix status processing failing halfway when a remote post has a malformed `replies` attribute ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/31246)) -- Fix `--verbose` option of `tootctl media remove`, which was previously erroneously removed ([mjankowski](https://github.com/mastodon/mastodon/pull/30536)) -- Fix division by zero on some video/GIF files ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/30600)) -- Fix Web UI trying to save user settings despite being logged out ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/30324)) -- Fix hashtag regexp matching some link anchors ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/30190)) -- Fix local account search on LDAP login being case-sensitive ([raucao](https://github.com/mastodon/mastodon/pull/30113)) -- Fix development environment admin account not being auto-approved ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/29958)) -- Fix report reason selector in moderation interface not unselecting rules when changing category ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/29026)) -- Fix already-invalid reports failing to resolve ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/29027)) -- Fix OCR when using S3/CDN for assets ([vmstan](https://github.com/mastodon/mastodon/pull/28551)) -- Fix error when encountering malformed `Tag` objects from Kbin ([ShadowJonathan](https://github.com/mastodon/mastodon/pull/28235)) -- Fix not all allowed image formats showing in file picker when uploading custom emoji ([june128](https://github.com/mastodon/mastodon/pull/28076)) -- Fix search popout listing unusable search options when logged out ([ClearlyClaire](https://github.com/mastodon/mastodon/pull/27918)) -- Fix processing of featured collections lacking an `items` attribute ([tribela](https://github.com/mastodon/mastodon/pull/27581)) -- Fix `mastodon:stats` decoration of stats rake task ([mjankowski](https://github.com/mastodon/mastodon/pull/31104)) - ## [4.2.10] - 2024-07-04 ### Security diff --git a/Gemfile.lock b/Gemfile.lock index 436f670a69f925..34958703a9ff06 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -604,8 +604,8 @@ GEM responders (3.1.0) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.3.5) - strscan + rexml (3.2.8) + strscan (>= 3.0.9) rotp (6.3.0) rouge (4.1.2) rpam2 (4.0.2) @@ -731,7 +731,7 @@ GEM redlock (~> 1.0) strong_migrations (0.8.0) activerecord (>= 5.2) - strscan (3.1.0) + strscan (3.0.9) swd (1.3.0) activesupport (>= 3) attr_required (>= 0.0.5) diff --git a/app/javascript/mastodon/actions/settings.js b/app/javascript/mastodon/actions/settings.js index fbd89f9d4b0b52..3685b0684e0b83 100644 --- a/app/javascript/mastodon/actions/settings.js +++ b/app/javascript/mastodon/actions/settings.js @@ -20,7 +20,7 @@ export function changeSetting(path, value) { } const debouncedSave = debounce((dispatch, getState) => { - if (getState().getIn(['settings', 'saved']) || !getState().getIn(['meta', 'me'])) { + if (getState().getIn(['settings', 'saved'])) { return; } diff --git a/app/javascript/mastodon/components/admin/ReportReasonSelector.jsx b/app/javascript/mastodon/components/admin/ReportReasonSelector.jsx index 90f4334a6e1ad2..ecce92b309429d 100644 --- a/app/javascript/mastodon/components/admin/ReportReasonSelector.jsx +++ b/app/javascript/mastodon/components/admin/ReportReasonSelector.jsx @@ -124,7 +124,7 @@ class ReportReasonSelector extends PureComponent { api().put(`/api/v1/admin/reports/${id}`, { category, - rule_ids: category === 'violation' ? rule_ids : [], + rule_ids, }).catch(err => { console.error(err); }); diff --git a/app/javascript/mastodon/components/dropdown_menu.jsx b/app/javascript/mastodon/components/dropdown_menu.jsx index 2457692cd8675d..fd66310e856ee6 100644 --- a/app/javascript/mastodon/components/dropdown_menu.jsx +++ b/app/javascript/mastodon/components/dropdown_menu.jsx @@ -40,7 +40,6 @@ class DropdownMenu extends PureComponent { if (this.node && !this.node.contains(e.target)) { this.props.onClose(); e.stopPropagation(); - e.preventDefault(); } }; diff --git a/app/javascript/mastodon/features/compose/components/search.jsx b/app/javascript/mastodon/features/compose/components/search.jsx index 56a4292c445ce5..7e1d8b76094d03 100644 --- a/app/javascript/mastodon/features/compose/components/search.jsx +++ b/app/javascript/mastodon/features/compose/components/search.jsx @@ -274,7 +274,6 @@ class Search extends PureComponent { } _calculateOptions (value) { - const { signedIn } = this.context.identity; const trimmedValue = value.trim(); const options = []; @@ -299,7 +298,7 @@ class Search extends PureComponent { const couldBeStatusSearch = searchEnabled; - if (couldBeStatusSearch && signedIn) { + if (couldBeStatusSearch) { options.push({ key: 'status-search', label: {trimmedValue} }} />, action: this.handleStatusSearch }); } @@ -376,7 +375,7 @@ class Search extends PureComponent {

- {searchEnabled && signedIn ? ( + {searchEnabled ? (
{this.defaultOptions.map(({ key, label, action }, i) => (
) : (
- {searchEnabled ? ( - - ) : ( - - )} +
)} diff --git a/app/javascript/mastodon/features/ui/components/focal_point_modal.jsx b/app/javascript/mastodon/features/ui/components/focal_point_modal.jsx index 8ce3733b7d2352..0c2e3901ea5e6e 100644 --- a/app/javascript/mastodon/features/ui/components/focal_point_modal.jsx +++ b/app/javascript/mastodon/features/ui/components/focal_point_modal.jsx @@ -221,7 +221,7 @@ class FocalPointModal extends ImmutablePureComponent { const worker = createWorker({ workerPath: tesseractWorkerPath, corePath: tesseractCorePath, - langPath: `${assetHost}/ocr/lang-data`, + langPath: `${assetHost}/ocr/lang-data/`, logger: ({ status, progress }) => { if (status === 'recognizing text') { this.setState({ ocrStatus: 'detecting', progress }); diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index e12ae5f9317677..5244ee4bb2e8c5 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -594,7 +594,6 @@ "search.quick_action.status_search": "Posts matching {x}", "search.search_or_paste": "Search or paste URL", "search_popout.full_text_search_disabled_message": "Not available on {domain}.", - "search_popout.full_text_search_logged_out_message": "Only available when logged in.", "search_popout.language_code": "ISO language code", "search_popout.options": "Search options", "search_popout.quick_actions": "Quick actions", diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index d93497521ada0a..1581555bde8087 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -332,15 +332,13 @@ def resolve_thread(status) def fetch_replies(status) collection = @object['replies'] - return if collection.blank? + return if collection.nil? replies = ActivityPub::FetchRepliesService.new.call(status, collection, allow_synchronous_requests: false, request_id: @options[:request_id]) return unless replies.nil? uri = value_or_id(collection) ActivityPub::FetchRepliesWorker.perform_async(status.id, uri, { 'request_id' => @options[:request_id] }) unless uri.nil? - rescue => e - Rails.logger.warn "Error fetching replies: #{e}" end def conversation_from_uri(uri) diff --git a/app/lib/activitypub/adapter.rb b/app/lib/activitypub/adapter.rb index 5b9437eb8dad40..098b6296fb053e 100644 --- a/app/lib/activitypub/adapter.rb +++ b/app/lib/activitypub/adapter.rb @@ -20,6 +20,6 @@ def serializable_hash(options = nil) serialized_hash = serialized_hash.select { |k, _| options[:fields].include?(k) } if options[:fields] serialized_hash = self.class.transform_key_casing!(serialized_hash, instance_options) - { '@context': serialized_context(named_contexts, context_extensions) }.merge(serialized_hash) + { '@context' => serialized_context(named_contexts, context_extensions) }.merge(serialized_hash) end end diff --git a/app/lib/video_metadata_extractor.rb b/app/lib/video_metadata_extractor.rb index 2155766251e35d..df5409375f16ef 100644 --- a/app/lib/video_metadata_extractor.rb +++ b/app/lib/video_metadata_extractor.rb @@ -41,8 +41,8 @@ def parse_metadata @colorspace = video_stream[:pix_fmt] @width = video_stream[:width] @height = video_stream[:height] - @frame_rate = parse_framerate(video_stream[:avg_frame_rate]) - @r_frame_rate = parse_framerate(video_stream[:r_frame_rate]) + @frame_rate = video_stream[:avg_frame_rate] == '0/0' ? nil : Rational(video_stream[:avg_frame_rate]) + @r_frame_rate = video_stream[:r_frame_rate] == '0/0' ? nil : Rational(video_stream[:r_frame_rate]) # For some video streams the frame_rate reported by `ffprobe` will be 0/0, but for these streams we # should use `r_frame_rate` instead. Video screencast generated by Gnome Screencast have this issue. @frame_rate ||= @r_frame_rate @@ -55,10 +55,4 @@ def parse_metadata @invalid = true if @metadata.key?(:error) end - - def parse_framerate(raw) - Rational(raw) - rescue ZeroDivisionError - nil - end end diff --git a/app/lib/webfinger.rb b/app/lib/webfinger.rb index 01a5dbc21d914b..ae8a3b1eae0264 100644 --- a/app/lib/webfinger.rb +++ b/app/lib/webfinger.rb @@ -6,8 +6,6 @@ class GoneError < Error; end class RedirectError < Error; end class Response - ACTIVITYPUB_READY_TYPE = ['application/activity+json', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'].freeze - attr_reader :uri def initialize(uri, body) @@ -22,28 +20,17 @@ def subject end def link(rel, attribute) - links.dig(rel, 0, attribute) - end - - def self_link_href - self_link.fetch('href') + links.dig(rel, attribute) end private def links - @links ||= @json.fetch('links', []).group_by { |link| link['rel'] } - end - - def self_link - links.fetch('self', []).find do |link| - ACTIVITYPUB_READY_TYPE.include?(link['type']) - end + @links ||= @json['links'].index_by { |link| link['rel'] } end def validate_response! raise Webfinger::Error, "Missing subject in response for #{@uri}" if subject.blank? - raise Webfinger::Error, "Missing self link in response for #{@uri}" if self_link.blank? end end diff --git a/app/models/account.rb b/app/models/account.rb index 17882db9a34251..a25ebc4aaf15d3 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -66,7 +66,7 @@ class Account < ApplicationRecord BACKGROUND_REFRESH_INTERVAL = 1.week.freeze USERNAME_RE = /[a-z0-9_]+([a-z0-9_.-]+[a-z0-9_]+)?/i - MENTION_RE = %r{(? { (category_changed? || rule_ids_changed?) && !violation? } + validates :rule_ids, absence: true, unless: :violation? - validate :validate_rule_ids, if: -> { (category_changed? || rule_ids_changed?) && violation? } + validate :validate_rule_ids # entries here need to be kept in sync with the front-end: # - app/javascript/mastodon/features/notifications/components/report.jsx @@ -154,6 +154,8 @@ def set_uri end def validate_rule_ids + return unless violation? + errors.add(:rule_ids, I18n.t('reports.errors.invalid_rules')) unless rules.size == rule_ids&.size end diff --git a/app/models/tag.rb b/app/models/tag.rb index 2d75aa2cc5096d..8fab98fb5c0107 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -35,7 +35,7 @@ class Tag < ApplicationRecord HASHTAG_LAST_SEQUENCE = '([[:word:]_]*[[:alpha:]][[:word:]_]*)' HASHTAG_NAME_PAT = "#{HASHTAG_FIRST_SEQUENCE}|#{HASHTAG_LAST_SEQUENCE}" - HASHTAG_RE = %r{(? e raise Error, e.message rescue Webfinger::Error => e diff --git a/app/services/activitypub/process_status_update_service.rb b/app/services/activitypub/process_status_update_service.rb index c4a5f5115b69b3..ec983510b91414 100644 --- a/app/services/activitypub/process_status_update_service.rb +++ b/app/services/activitypub/process_status_update_service.rb @@ -172,9 +172,9 @@ def update_metadata! as_array(@json['tag']).each do |tag| if equals_or_includes?(tag['type'], 'Hashtag') - @raw_tags << tag['name'] if tag['name'].present? + @raw_tags << tag['name'] elsif equals_or_includes?(tag['type'], 'Mention') - @raw_mentions << tag['href'] if tag['href'].present? + @raw_mentions << tag['href'] elsif equals_or_includes?(tag['type'], 'Emoji') @raw_emojis << tag end diff --git a/app/services/backup_service.rb b/app/services/backup_service.rb index 5bfa69f32ad3bd..b3282c409b41dc 100644 --- a/app/services/backup_service.rb +++ b/app/services/backup_service.rb @@ -19,8 +19,8 @@ def call(backup) def build_outbox_json!(file) skeleton = serialize(collection_presenter, ActivityPub::CollectionSerializer) - skeleton[:@context] = full_context - skeleton[:orderedItems] = ['!PLACEHOLDER!'] + skeleton['@context'] = full_context + skeleton['orderedItems'] = ['!PLACEHOLDER!'] skeleton = Oj.dump(skeleton) prepend, append = skeleton.split('"!PLACEHOLDER!"') add_comma = false @@ -33,7 +33,7 @@ def build_outbox_json!(file) file.write(statuses.map do |status| item = serialize_payload(ActivityPub::ActivityPresenter.from_status(status), ActivityPub::ActivitySerializer) - item.delete(:@context) + item.delete('@context') unless item[:type] == 'Announce' || item[:object][:attachment].blank? item[:object][:attachment].each do |attachment| diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb index 515248979ae076..759d6e393730ca 100644 --- a/app/services/notify_service.rb +++ b/app/services/notify_service.rb @@ -86,8 +86,7 @@ def response_to_recipient? end def from_staff? - sender = @notification.from_account - sender.local? && sender.user.present? && sender.user_role&.overrides?(@recipient.user_role) && sender.user_role&.highlighted? && sender.user_role&.can?(*UserRole::Flags::CATEGORIES[:moderation].map(&:to_sym)) + @notification.from_account.local? && @notification.from_account.user.present? && @notification.from_account.user_role&.overrides?(@recipient.user_role) end def optional_non_following_and_direct? diff --git a/app/services/resolve_account_service.rb b/app/services/resolve_account_service.rb index 842c0040a2e881..6204fefd6ff790 100644 --- a/app/services/resolve_account_service.rb +++ b/app/services/resolve_account_service.rb @@ -104,6 +104,8 @@ def split_acct(acct) end def fetch_account! + return unless activitypub_ready? + with_redis_lock("resolve:#{@username}@#{@domain}") do @account = ActivityPub::FetchRemoteAccountService.new.call(actor_url, suppress_errors: @options[:suppress_errors]) end @@ -118,8 +120,12 @@ def webfinger_update_due? @options[:skip_cache] || @account.nil? || @account.possibly_stale? end + def activitypub_ready? + ['application/activity+json', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'].include?(@webfinger.link('self', 'type')) + end + def actor_url - @actor_url ||= @webfinger.self_link_href + @actor_url ||= @webfinger.link('self', 'href') end def gone_from_origin? diff --git a/app/views/admin/custom_emojis/new.html.haml b/app/views/admin/custom_emojis/new.html.haml index a03676b001c9e3..95996dec86164d 100644 --- a/app/views/admin/custom_emojis/new.html.haml +++ b/app/views/admin/custom_emojis/new.html.haml @@ -7,7 +7,7 @@ .fields-group = f.input :shortcode, wrapper: :with_label, label: t('admin.custom_emojis.shortcode'), hint: t('admin.custom_emojis.shortcode_hint') .fields-group - = f.input :image, wrapper: :with_label, input_html: { accept: CustomEmoji::IMAGE_MIME_TYPES.join(',') }, hint: t('admin.custom_emojis.image_hint', size: number_to_human_size(CustomEmoji::LIMIT)) + = f.input :image, wrapper: :with_label, input_html: { accept: CustomEmoji::IMAGE_MIME_TYPES.join(' ') }, hint: t('admin.custom_emojis.image_hint', size: number_to_human_size(CustomEmoji::LIMIT)) .actions = f.button :button, t('admin.custom_emojis.upload'), type: :submit diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index 8125b335f95539..6d8284e2b45b40 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -142,7 +142,7 @@ def paging_request? end throttle('throttle_password_change/account', limit: 10, period: 10.minutes) do |req| - req.warden_user_id if (req.put? || req.patch?) && (req.path_matches?('/auth') || req.path_matches?('/auth/password')) + req.warden_user_id if req.put? || (req.patch? && req.path_matches?('/auth')) end self.throttled_responder = lambda do |request| diff --git a/db/seeds/04_admin.rb b/db/seeds/04_admin.rb index 887b4a22130376..c9b0369c9f3281 100644 --- a/db/seeds/04_admin.rb +++ b/db/seeds/04_admin.rb @@ -7,7 +7,5 @@ admin = Account.where(username: 'admin').first_or_initialize(username: 'admin') admin.save(validate: false) - user = User.where(email: "admin@#{domain}").first_or_initialize(email: "admin@#{domain}", password: 'mastodonadmin', password_confirmation: 'mastodonadmin', confirmed_at: Time.now.utc, role: UserRole.find_by(name: 'Owner'), account: admin, agreement: true, approved: true) - user.save! - user.approve! + User.where(email: "admin@#{domain}").first_or_initialize(email: "admin@#{domain}", password: 'mastodonadmin', password_confirmation: 'mastodonadmin', confirmed_at: Time.now.utc, role: UserRole.find_by(name: 'Owner'), account: admin, agreement: true, approved: true).save! end diff --git a/docker-compose.yml b/docker-compose.yml index d4d5e89febfa9b..d61aa05582806c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -56,7 +56,7 @@ services: web: build: . - image: ghcr.io/mastodon/mastodon:v4.2.12 + image: ghcr.io/mastodon/mastodon:v4.2.10 restart: always env_file: .env.production command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000" @@ -77,7 +77,7 @@ services: streaming: build: . - image: ghcr.io/mastodon/mastodon:v4.2.12 + image: ghcr.io/mastodon/mastodon:v4.2.10 restart: always env_file: .env.production command: node ./streaming @@ -95,7 +95,7 @@ services: sidekiq: build: . - image: ghcr.io/mastodon/mastodon:v4.2.12 + image: ghcr.io/mastodon/mastodon:v4.2.10 restart: always env_file: .env.production command: bundle exec sidekiq diff --git a/lib/mastodon/cli/media.rb b/lib/mastodon/cli/media.rb index 61132646192c11..5879c532e80a99 100644 --- a/lib/mastodon/cli/media.rb +++ b/lib/mastodon/cli/media.rb @@ -13,7 +13,6 @@ class Media < Base option :remove_headers, type: :boolean, default: false option :include_follows, type: :boolean, default: false option :concurrency, type: :numeric, default: 5, aliases: [:c] - option :verbose, type: :boolean, default: false, aliases: [:v] option :dry_run, type: :boolean, default: false desc 'remove', 'Remove remote media files, headers or avatars' long_desc <<-DESC diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index f0e0554c3f26c4..77e85a16528046 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -13,7 +13,7 @@ def minor end def patch - 12 + 10 end def default_prerelease diff --git a/lib/sanitize_ext/sanitize_config.rb b/lib/sanitize_ext/sanitize_config.rb index 520e6cba9ea760..bdb4c56a085c0f 100644 --- a/lib/sanitize_ext/sanitize_config.rb +++ b/lib/sanitize_ext/sanitize_config.rb @@ -65,7 +65,7 @@ module Config end MASTODON_STRICT ||= freeze_config( - elements: %w(p br span a del s pre blockquote code b strong u i em ul ol li), + elements: %w(p br span a del pre blockquote code b strong u i em ul ol li), attributes: { 'a' => %w(href rel class translate), diff --git a/lib/tasks/statistics.rake b/lib/tasks/statistics.rake index 82840f4fdc842e..dde7890f6b445d 100644 --- a/lib/tasks/statistics.rake +++ b/lib/tasks/statistics.rake @@ -9,13 +9,11 @@ namespace :mastodon do [ ['App Libraries', 'app/lib'], %w(Presenters app/presenters), - %w(Policies app/policies), - %w(Serializers app/serializers), %w(Services app/services), %w(Validators app/validators), %w(Workers app/workers), ].each do |name, dir| - STATS_DIRECTORIES << [name, dir] + STATS_DIRECTORIES << [name, Rails.root.join(dir)] end end end diff --git a/spec/fixtures/requests/activitypub-webfinger.txt b/spec/fixtures/requests/activitypub-webfinger.txt index 733b1693dc8807..465066d84e1032 100644 --- a/spec/fixtures/requests/activitypub-webfinger.txt +++ b/spec/fixtures/requests/activitypub-webfinger.txt @@ -4,4 +4,4 @@ Content-Type: application/jrd+json; charset=utf-8 X-Content-Type-Options: nosniff Date: Sun, 17 Sep 2017 06:22:50 GMT -{"subject":"acct:foo@ap.example.com","aliases":["https://ap.example.com/@foo","https://ap.example.com/users/foo"],"links":[{"rel":"http://webfinger.net/rel/profile-page","type":"text/html","href":"https://ap.example.com/@foo"},{"rel":"http://schemas.google.com/g/2010#updates-from","type":"application/atom+xml","href":"https://ap.example.com/users/foo.atom"},{"rel":"self","type":"application/html","href":"https://ap.example.com/users/foo.html"},{"rel":"self","type":"application/activity+json","href":"https://ap.example.com/users/foo"},{"rel":"self","type":"application/json","href":"https://ap.example.com/users/foo.json"},{"rel":"salmon","href":"https://ap.example.com/api/salmon/1"},{"rel":"magic-public-key","href":"data:application/magic-public-key,RSA.u3L4vnpNLzVH31MeWI394F0wKeJFsLDAsNXGeOu0QF2x-h1zLWZw_agqD2R3JPU9_kaDJGPIV2Sn5zLyUA9S6swCCMOtn7BBR9g9sucgXJmUFB0tACH2QSgHywMAybGfmSb3LsEMNKsGJ9VsvYoh8lDET6X4Pyw-ZJU0_OLo_41q9w-OrGtlsTm_PuPIeXnxa6BLqnDaxC-4IcjG_FiPahNCTINl_1F_TgSSDZ4Taf4U9XFEIFw8wmgploELozzIzKq-t8nhQYkgAkt64euWpva3qL5KD1mTIZQEP-LZvh3s2WHrLi3fhbdRuwQ2c0KkJA2oSTFPDpqqbPGZ3QvuHQ==.AQAB"},{"rel":"http://ostatus.org/schema/1.0/subscribe","template":"https://ap.example.com/authorize_follow?acct={uri}"}]} \ No newline at end of file +{"subject":"acct:foo@ap.example.com","aliases":["https://ap.example.com/@foo","https://ap.example.com/users/foo"],"links":[{"rel":"http://webfinger.net/rel/profile-page","type":"text/html","href":"https://ap.example.com/@foo"},{"rel":"http://schemas.google.com/g/2010#updates-from","type":"application/atom+xml","href":"https://ap.example.com/users/foo.atom"},{"rel":"self","type":"application/activity+json","href":"https://ap.example.com/users/foo"},{"rel":"salmon","href":"https://ap.example.com/api/salmon/1"},{"rel":"magic-public-key","href":"data:application/magic-public-key,RSA.u3L4vnpNLzVH31MeWI394F0wKeJFsLDAsNXGeOu0QF2x-h1zLWZw_agqD2R3JPU9_kaDJGPIV2Sn5zLyUA9S6swCCMOtn7BBR9g9sucgXJmUFB0tACH2QSgHywMAybGfmSb3LsEMNKsGJ9VsvYoh8lDET6X4Pyw-ZJU0_OLo_41q9w-OrGtlsTm_PuPIeXnxa6BLqnDaxC-4IcjG_FiPahNCTINl_1F_TgSSDZ4Taf4U9XFEIFw8wmgploELozzIzKq-t8nhQYkgAkt64euWpva3qL5KD1mTIZQEP-LZvh3s2WHrLi3fhbdRuwQ2c0KkJA2oSTFPDpqqbPGZ3QvuHQ==.AQAB"},{"rel":"http://ostatus.org/schema/1.0/subscribe","template":"https://ap.example.com/authorize_follow?acct={uri}"}]} \ No newline at end of file diff --git a/spec/fixtures/requests/webfinger.txt b/spec/fixtures/requests/webfinger.txt index fce821bddbf5c8..f337ecae6f1501 100644 --- a/spec/fixtures/requests/webfinger.txt +++ b/spec/fixtures/requests/webfinger.txt @@ -8,4 +8,4 @@ Access-Control-Allow-Origin: * Vary: Accept-Encoding,Cookie Strict-Transport-Security: max-age=31536000; includeSubdomains; -{"subject":"acct:gargron@quitter.no","aliases":["https:\/\/quitter.no\/user\/7477","https:\/\/quitter.no\/gargron","https:\/\/quitter.no\/index.php\/user\/7477","https:\/\/quitter.no\/index.php\/gargron"],"links":[{"rel":"http:\/\/webfinger.net\/rel\/profile-page","type":"text\/html","href":"https:\/\/quitter.no\/gargron"},{"rel":"http:\/\/gmpg.org\/xfn\/11","type":"text\/html","href":"https:\/\/quitter.no\/gargron"},{"rel":"describedby","type":"application\/rdf+xml","href":"https:\/\/quitter.no\/gargron\/foaf"},{"rel":"self","type":"application/activity+json","href":"https://ap.example.com/users/foo"},{"rel":"http:\/\/apinamespace.org\/atom","type":"application\/atomsvc+xml","href":"https:\/\/quitter.no\/api\/statusnet\/app\/service\/gargron.xml"},{"rel":"http:\/\/apinamespace.org\/twitter","href":"https:\/\/quitter.no\/api\/"},{"rel":"http:\/\/specs.openid.net\/auth\/2.0\/provider","href":"https:\/\/quitter.no\/gargron"},{"rel":"http:\/\/schemas.google.com\/g\/2010#updates-from","type":"application\/atom+xml","href":"https:\/\/quitter.no\/api\/statuses\/user_timeline\/7477.atom"},{"rel":"magic-public-key","href":"data:application\/magic-public-key,RSA.1ZBkHTavLvxH3FzlKv4O6WtlILKRFfNami3_Rcu8EuogtXSYiS-bB6hElZfUCSHbC4uLemOA34PEhz__CDMozax1iI_t8dzjDnh1x0iFSup7pSfW9iXk_WU3Dm74yWWW2jildY41vWgrEstuQ1dJ8vVFfSJ9T_tO4c-T9y8vDI8=.AQAB"},{"rel":"salmon","href":"https:\/\/quitter.no\/main\/salmon\/user\/7477"},{"rel":"http:\/\/salmon-protocol.org\/ns\/salmon-replies","href":"https:\/\/quitter.no\/main\/salmon\/user\/7477"},{"rel":"http:\/\/salmon-protocol.org\/ns\/salmon-mention","href":"https:\/\/quitter.no\/main\/salmon\/user\/7477"},{"rel":"http:\/\/ostatus.org\/schema\/1.0\/subscribe","template":"https:\/\/quitter.no\/main\/ostatussub?profile={uri}"}]} +{"subject":"acct:gargron@quitter.no","aliases":["https:\/\/quitter.no\/user\/7477","https:\/\/quitter.no\/gargron","https:\/\/quitter.no\/index.php\/user\/7477","https:\/\/quitter.no\/index.php\/gargron"],"links":[{"rel":"http:\/\/webfinger.net\/rel\/profile-page","type":"text\/html","href":"https:\/\/quitter.no\/gargron"},{"rel":"http:\/\/gmpg.org\/xfn\/11","type":"text\/html","href":"https:\/\/quitter.no\/gargron"},{"rel":"describedby","type":"application\/rdf+xml","href":"https:\/\/quitter.no\/gargron\/foaf"},{"rel":"http:\/\/apinamespace.org\/atom","type":"application\/atomsvc+xml","href":"https:\/\/quitter.no\/api\/statusnet\/app\/service\/gargron.xml"},{"rel":"http:\/\/apinamespace.org\/twitter","href":"https:\/\/quitter.no\/api\/"},{"rel":"http:\/\/specs.openid.net\/auth\/2.0\/provider","href":"https:\/\/quitter.no\/gargron"},{"rel":"http:\/\/schemas.google.com\/g\/2010#updates-from","type":"application\/atom+xml","href":"https:\/\/quitter.no\/api\/statuses\/user_timeline\/7477.atom"},{"rel":"magic-public-key","href":"data:application\/magic-public-key,RSA.1ZBkHTavLvxH3FzlKv4O6WtlILKRFfNami3_Rcu8EuogtXSYiS-bB6hElZfUCSHbC4uLemOA34PEhz__CDMozax1iI_t8dzjDnh1x0iFSup7pSfW9iXk_WU3Dm74yWWW2jildY41vWgrEstuQ1dJ8vVFfSJ9T_tO4c-T9y8vDI8=.AQAB"},{"rel":"salmon","href":"https:\/\/quitter.no\/main\/salmon\/user\/7477"},{"rel":"http:\/\/salmon-protocol.org\/ns\/salmon-replies","href":"https:\/\/quitter.no\/main\/salmon\/user\/7477"},{"rel":"http:\/\/salmon-protocol.org\/ns\/salmon-mention","href":"https:\/\/quitter.no\/main\/salmon\/user\/7477"},{"rel":"http:\/\/ostatus.org\/schema\/1.0\/subscribe","template":"https:\/\/quitter.no\/main\/ostatussub?profile={uri}"}]} diff --git a/spec/lib/activitypub/adapter_spec.rb b/spec/lib/activitypub/adapter_spec.rb index bd63ebb9c87657..f9f8b8dce0d81d 100644 --- a/spec/lib/activitypub/adapter_spec.rb +++ b/spec/lib/activitypub/adapter_spec.rb @@ -59,7 +59,7 @@ def virtual_object let(:serializer_class) { TestWithBasicContextSerializer } it 'renders a basic @context' do - expect(subject).to include({ '@context': 'https://www.w3.org/ns/activitystreams' }) + expect(subject).to include({ '@context' => 'https://www.w3.org/ns/activitystreams' }) end end @@ -67,7 +67,7 @@ def virtual_object let(:serializer_class) { TestWithNamedContextSerializer } it 'renders a @context with both items' do - expect(subject).to include({ '@context': ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1'] }) + expect(subject).to include({ '@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1'] }) end end @@ -75,7 +75,7 @@ def virtual_object let(:serializer_class) { TestWithNestedNamedContextSerializer } it 'renders a @context with both items' do - expect(subject).to include({ '@context': ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1'] }) + expect(subject).to include({ '@context' => ['https://www.w3.org/ns/activitystreams', 'https://w3id.org/security/v1'] }) end end @@ -83,7 +83,7 @@ def virtual_object let(:serializer_class) { TestWithContextExtensionSerializer } it 'renders a @context with the extension' do - expect(subject).to include({ '@context': ['https://www.w3.org/ns/activitystreams', { 'sensitive' => 'as:sensitive' }] }) + expect(subject).to include({ '@context' => ['https://www.w3.org/ns/activitystreams', { 'sensitive' => 'as:sensitive' }] }) end end @@ -91,7 +91,7 @@ def virtual_object let(:serializer_class) { TestWithNestedContextExtensionSerializer } it 'renders a @context with both extensions' do - expect(subject).to include({ '@context': ['https://www.w3.org/ns/activitystreams', { 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers', 'sensitive' => 'as:sensitive' }] }) + expect(subject).to include({ '@context' => ['https://www.w3.org/ns/activitystreams', { 'manuallyApprovesFollowers' => 'as:manuallyApprovesFollowers', 'sensitive' => 'as:sensitive' }] }) end end end diff --git a/spec/lib/webfinger_spec.rb b/spec/lib/webfinger_spec.rb deleted file mode 100644 index 5015deac7ffd87..00000000000000 --- a/spec/lib/webfinger_spec.rb +++ /dev/null @@ -1,41 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe Webfinger do - describe 'self link' do - context 'when self link is specified with type application/activity+json' do - let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/alice', type: 'application/activity+json' }] } } - - it 'correctly parses the response' do - stub_request(:get, 'https://example.com/.well-known/webfinger?resource=acct:alice@example.com').to_return(body: Oj.dump(webfinger), headers: { 'Content-Type': 'application/jrd+json' }) - - response = described_class.new('acct:alice@example.com').perform - - expect(response.self_link_href).to eq 'https://example.com/alice' - end - end - - context 'when self link is specified with type application/ld+json' do - let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/alice', type: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' }] } } - - it 'correctly parses the response' do - stub_request(:get, 'https://example.com/.well-known/webfinger?resource=acct:alice@example.com').to_return(body: Oj.dump(webfinger), headers: { 'Content-Type': 'application/jrd+json' }) - - response = described_class.new('acct:alice@example.com').perform - - expect(response.self_link_href).to eq 'https://example.com/alice' - end - end - - context 'when self link is specified with incorrect type' do - let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/alice', type: 'application/json"' }] } } - - it 'raises an error' do - stub_request(:get, 'https://example.com/.well-known/webfinger?resource=acct:alice@example.com').to_return(body: Oj.dump(webfinger), headers: { 'Content-Type': 'application/jrd+json' }) - - expect { described_class.new('acct:alice@example.com').perform }.to raise_error(Webfinger::Error) - end - end - end -end diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index 5fcbf46073f78b..fc7a43110b20e4 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -703,14 +703,6 @@ it 'does not match URL query string' do expect(subject.match('https://example.com/?x=@alice')).to be_nil end - - it 'matches usernames immediately following the letter ß' do - expect(subject.match('Hello toß @alice from me')[1]).to eq 'alice' - end - - it 'matches usernames containing uppercase characters' do - expect(subject.match('Hello to @aLice@Example.com from me')[1]).to eq 'aLice@Example.com' - end end describe 'validations' do diff --git a/spec/models/report_spec.rb b/spec/models/report_spec.rb index 830f2f6085fd0c..0093dcd8de9496 100644 --- a/spec/models/report_spec.rb +++ b/spec/models/report_spec.rb @@ -133,18 +133,5 @@ report = Fabricate.build(:report, account: remote_account, comment: Faker::Lorem.characters(number: 1001)) expect(report.valid?).to be true end - - it 'is invalid if it references invalid rules' do - report = Fabricate.build(:report, category: :violation, rule_ids: [-1]) - expect(report.valid?).to be false - expect(report).to model_have_error_on_field(:rule_ids) - end - - it 'is invalid if it references rules but category is not "violation"' do - rule = Fabricate(:rule) - report = Fabricate.build(:report, category: :spam, rule_ids: rule.id) - expect(report.valid?).to be false - expect(report).to model_have_error_on_field(:rule_ids) - end end end diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb index 529de32695aaf9..6177b7a25a6d02 100644 --- a/spec/models/tag_spec.rb +++ b/spec/models/tag_spec.rb @@ -36,10 +36,6 @@ expect(subject.match('https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111895#c4')).to be_nil end - it 'does not match URLs with hashtag-like anchors after a non-ascii character' do - expect(subject.match('https://example.org/testé#foo')).to be_nil - end - it 'does not match URLs with hashtag-like anchors after an empty query parameter' do expect(subject.match('https://en.wikipedia.org/wiki/Ghostbusters_(song)?foo=#Lawsuit')).to be_nil end @@ -95,14 +91,6 @@ it 'does not match purely-numeric hashtags' do expect(subject.match('hello #0123456')).to be_nil end - - it 'matches hashtags immediately following the letter ß' do - expect(subject.match('Hello toß #ruby').to_s).to eq '#ruby' - end - - it 'matches hashtags containing uppercase characters' do - expect(subject.match('Hello #rubyOnRails').to_s).to eq '#rubyOnRails' - end end describe '#to_param' do diff --git a/spec/services/activitypub/fetch_featured_collection_service_spec.rb b/spec/services/activitypub/fetch_featured_collection_service_spec.rb index 237fc7123e9ae4..583212c3756031 100644 --- a/spec/services/activitypub/fetch_featured_collection_service_spec.rb +++ b/spec/services/activitypub/fetch_featured_collection_service_spec.rb @@ -42,22 +42,12 @@ } end - let(:featured_with_null) do - { - '@context': 'https://www.w3.org/ns/activitystreams', - id: 'https://example.com/account/collections/featured', - totalItems: 0, - type: 'OrderedCollection', - } - end - let(:items) do [ 'https://example.com/account/pinned/known', # known status_json_pinned_unknown_inlined, # unknown inlined 'https://example.com/account/pinned/unknown-unreachable', # unknown unreachable 'https://example.com/account/pinned/unknown-reachable', # unknown reachable - 'https://example.com/account/collections/featured', # featured with null ] end @@ -76,7 +66,6 @@ stub_request(:get, 'https://example.com/account/pinned/unknown-inlined').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_inlined), headers: { 'Content-Type': 'application/activity+json' }) stub_request(:get, 'https://example.com/account/pinned/unknown-unreachable').to_return(status: 404) stub_request(:get, 'https://example.com/account/pinned/unknown-reachable').to_return(status: 200, body: Oj.dump(status_json_pinned_unknown_reachable), headers: { 'Content-Type': 'application/activity+json' }) - stub_request(:get, 'https://example.com/account/collections/featured').to_return(status: 200, body: Oj.dump(featured_with_null), headers: { 'Content-Type': 'application/activity+json' }) subject.call(actor, note: true, hashtag: false) end diff --git a/spec/services/activitypub/fetch_remote_account_service_spec.rb b/spec/services/activitypub/fetch_remote_account_service_spec.rb index a69a43f5291ca1..42badde0517980 100644 --- a/spec/services/activitypub/fetch_remote_account_service_spec.rb +++ b/spec/services/activitypub/fetch_remote_account_service_spec.rb @@ -39,7 +39,7 @@ end context 'when the account does not have a inbox' do - let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/alice', type: 'application/activity+json' }] } } + let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/alice' }] } } before do actor[:inbox] = nil @@ -64,7 +64,7 @@ end context 'when URI and WebFinger share the same host' do - let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/alice', type: 'application/activity+json' }] } } + let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/alice' }] } } before do stub_request(:get, 'https://example.com/alice').to_return(body: Oj.dump(actor), headers: { 'Content-Type': 'application/activity+json' }) @@ -90,7 +90,7 @@ end context 'when WebFinger presents different domain than URI' do - let!(:webfinger) { { subject: 'acct:alice@iscool.af', links: [{ rel: 'self', href: 'https://example.com/alice', type: 'application/activity+json' }] } } + let!(:webfinger) { { subject: 'acct:alice@iscool.af', links: [{ rel: 'self', href: 'https://example.com/alice' }] } } before do stub_request(:get, 'https://example.com/alice').to_return(body: Oj.dump(actor), headers: { 'Content-Type': 'application/activity+json' }) @@ -122,7 +122,7 @@ end context 'when WebFinger returns a different URI' do - let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/bob', type: 'application/activity+json' }] } } + let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/bob' }] } } before do stub_request(:get, 'https://example.com/alice').to_return(body: Oj.dump(actor), headers: { 'Content-Type': 'application/activity+json' }) @@ -145,7 +145,7 @@ end context 'when WebFinger returns a different URI after a redirection' do - let!(:webfinger) { { subject: 'acct:alice@iscool.af', links: [{ rel: 'self', href: 'https://example.com/bob', type: 'application/activity+json' }] } } + let!(:webfinger) { { subject: 'acct:alice@iscool.af', links: [{ rel: 'self', href: 'https://example.com/bob' }] } } before do stub_request(:get, 'https://example.com/alice').to_return(body: Oj.dump(actor), headers: { 'Content-Type': 'application/activity+json' }) diff --git a/spec/services/activitypub/fetch_remote_actor_service_spec.rb b/spec/services/activitypub/fetch_remote_actor_service_spec.rb index c92705130b9c87..6d264b7b825276 100644 --- a/spec/services/activitypub/fetch_remote_actor_service_spec.rb +++ b/spec/services/activitypub/fetch_remote_actor_service_spec.rb @@ -39,7 +39,7 @@ end context 'when the account does not have a inbox' do - let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/alice', type: 'application/activity+json' }] } } + let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/alice' }] } } before do actor[:inbox] = nil @@ -64,7 +64,7 @@ end context 'when URI and WebFinger share the same host' do - let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/alice', type: 'application/activity+json' }] } } + let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/alice' }] } } before do stub_request(:get, 'https://example.com/alice').to_return(body: Oj.dump(actor), headers: { 'Content-Type': 'application/activity+json' }) @@ -90,7 +90,7 @@ end context 'when WebFinger presents different domain than URI' do - let!(:webfinger) { { subject: 'acct:alice@iscool.af', links: [{ rel: 'self', href: 'https://example.com/alice', type: 'application/activity+json' }] } } + let!(:webfinger) { { subject: 'acct:alice@iscool.af', links: [{ rel: 'self', href: 'https://example.com/alice' }] } } before do stub_request(:get, 'https://example.com/alice').to_return(body: Oj.dump(actor), headers: { 'Content-Type': 'application/activity+json' }) @@ -122,7 +122,7 @@ end context 'when WebFinger returns a different URI' do - let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/bob', type: 'application/activity+json' }] } } + let!(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/bob' }] } } before do stub_request(:get, 'https://example.com/alice').to_return(body: Oj.dump(actor), headers: { 'Content-Type': 'application/activity+json' }) @@ -145,7 +145,7 @@ end context 'when WebFinger returns a different URI after a redirection' do - let!(:webfinger) { { subject: 'acct:alice@iscool.af', links: [{ rel: 'self', href: 'https://example.com/bob', type: 'application/activity+json' }] } } + let!(:webfinger) { { subject: 'acct:alice@iscool.af', links: [{ rel: 'self', href: 'https://example.com/bob' }] } } before do stub_request(:get, 'https://example.com/alice').to_return(body: Oj.dump(actor), headers: { 'Content-Type': 'application/activity+json' }) diff --git a/spec/services/activitypub/fetch_remote_key_service_spec.rb b/spec/services/activitypub/fetch_remote_key_service_spec.rb index 011f12915725b1..478778cc9f5762 100644 --- a/spec/services/activitypub/fetch_remote_key_service_spec.rb +++ b/spec/services/activitypub/fetch_remote_key_service_spec.rb @@ -5,7 +5,7 @@ RSpec.describe ActivityPub::FetchRemoteKeyService, type: :service do subject { described_class.new } - let(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/alice', type: 'application/activity+json' }] } } + let(:webfinger) { { subject: 'acct:alice@example.com', links: [{ rel: 'self', href: 'https://example.com/alice' }] } } let(:public_key_pem) do <<~TEXT diff --git a/spec/services/activitypub/process_account_service_spec.rb b/spec/services/activitypub/process_account_service_spec.rb index a3a084d23e99d9..60214d2ed839c1 100644 --- a/spec/services/activitypub/process_account_service_spec.rb +++ b/spec/services/activitypub/process_account_service_spec.rb @@ -217,7 +217,7 @@ }.with_indifferent_access webfinger = { subject: "acct:user#{i}@foo.test", - links: [{ rel: 'self', href: "https://foo.test/users/#{i}", type: 'application/activity+json' }], + links: [{ rel: 'self', href: "https://foo.test/users/#{i}" }], }.with_indifferent_access stub_request(:get, "https://foo.test/users/#{i}").to_return(status: 200, body: actor_json.to_json, headers: { 'Content-Type': 'application/activity+json' }) stub_request(:get, "https://foo.test/users/#{i}/featured").to_return(status: 200, body: featured_json.to_json, headers: { 'Content-Type': 'application/activity+json' }) diff --git a/spec/services/backup_service_spec.rb b/spec/services/backup_service_spec.rb index befff0b530e5d0..1eb789d1f5837f 100644 --- a/spec/services/backup_service_spec.rb +++ b/spec/services/backup_service_spec.rb @@ -60,7 +60,6 @@ def expect_outbox_export aggregate_failures do expect(body.scan('@context').count).to eq 1 - expect(body.scan('orderedItems').count).to eq 1 expect(json['@context']).to_not be_nil expect(json['type']).to eq 'OrderedCollection' expect(json['totalItems']).to eq 2 diff --git a/spec/services/notify_service_spec.rb b/spec/services/notify_service_spec.rb index 568fb1cdfdb6ec..c2664e79c23bb5 100644 --- a/spec/services/notify_service_spec.rb +++ b/spec/services/notify_service_spec.rb @@ -18,17 +18,6 @@ expect { subject }.to_not change(Notification, :count) end - context 'when the sender is a local moderator' do - let(:sender) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account } - let(:type) { :mention } - let(:activity) { Fabricate(:mention, account: recipient, status: Fabricate(:status, account: sender)) } - - it 'does notify when the sender is blocked' do - recipient.block!(sender) - expect { subject }.to change(Notification, :count).by(1) - end - end - it 'does not notify when sender is muted with hide_notifications' do recipient.mute!(sender, notifications: true) expect { subject }.to_not change(Notification, :count)