]> cat aescling's git repositories - mastodon.git/commitdiff
Merge branch 'main' into glitch-soc/merge-upstream
authorClaire <claire.github-309c@sitedethib.com>
Thu, 10 Mar 2022 08:52:45 +0000 (09:52 +0100)
committerClaire <claire.github-309c@sitedethib.com>
Thu, 10 Mar 2022 08:52:45 +0000 (09:52 +0100)
Conflicts:
- `app/models/status.rb`:
  Upstream updated media and edit-related code textually close to glitch-soc
  additions (local-only and content-type).
  Ported upstream changes.
- `app/models/status_edit.rb`:
  Upstream changes textually close to glitch-soc additions (content-type).
  Ported upstream changes.
- `app/serializers/activitypub/note_serializer.rb`:
  Upstream changed how media attachments are handled. Not really a conflict,
  but textually close to glitch-soc additions (directMessage attribute).
  Ported upstream changes.
- `app/services/remove_status_service.rb`:
  Upstream changed how media attachments are handled. Not really a conflict,
  but textually close to glitch-soc additions (DM timeline).
  Ported upstream changes.
- `app/services/update_status_service.rb`:
  Upstream fixed an issue with language selection. Not really a conflict,
  but textually close to glitch-soc additions (content-type).
  Ported upstream changes.
- `db/schema.rb`:
  Upstream added columns to the `status_edits` table, the conflict is because
  of an additional column (`content-type`) in glitch-soc.
  Ported upstream changes.
- `package.json`:
  Upstream dependency (express) textually adjacent to a glitch-soc-specific one
  (favico.js) got updated.
  Updated it as well.

25 files changed:
1  2 
Gemfile
Gemfile.lock
app/controllers/api/v1/statuses_controller.rb
app/javascript/mastodon/locales/defaultMessages.json
app/javascript/mastodon/locales/en.json
app/javascript/mastodon/locales/ja.json
app/javascript/mastodon/locales/pl.json
app/javascript/styles/mastodon/admin.scss
app/javascript/styles/mastodon/components.scss
app/lib/feed_manager.rb
app/models/status.rb
app/models/status_edit.rb
app/serializers/activitypub/note_serializer.rb
app/serializers/rest/status_serializer.rb
app/services/fan_out_on_write_service.rb
app/services/post_status_service.rb
app/services/remove_status_service.rb
app/services/update_status_service.rb
app/views/admin/domain_blocks/edit.html.haml
app/views/admin/domain_blocks/new.html.haml
app/views/statuses/_simple_status.html.haml
config/routes.rb
db/schema.rb
package.json
yarn.lock

diff --cc Gemfile
Simple merge
diff --cc Gemfile.lock
index 26429aec45b1ad40574cb34f537ce7355986593d,075a4e9cbad3ff65e20e425c1fa31084d6122da1..7201a0c0e2613b376dc7bb09f1a9468a9b72fcd0
@@@ -496,9 -521,8 +523,9 @@@ GE
        link_header (~> 0.0, >= 0.0.8)
      rdf-normalize (0.5.0)
        rdf (~> 3.2)
 +    redcarpet (3.5.1)
      redis (4.5.1)
-     redis-namespace (1.8.1)
+     redis-namespace (1.8.2)
        redis (>= 3.0.4)
      regexp_parser (2.2.0)
      request_store (1.5.0)
@@@ -720,8 -757,8 +760,9 @@@ DEPENDENCIE
    fog-core (<= 2.1.0)
    fog-openstack (~> 0.3)
    fuubar (~> 2.5)
+   gitlab-omniauth-openid-connect (~> 0.5.0)
    hamlit-rails (~> 0.2)
 +  hcaptcha (~> 7.1)
    hiredis (~> 0.6)
    htmlentities (~> 4.3)
    http (~> 5.0)
Simple merge
index 6a848baee1e47cb09867769f4b19efe2449f6906,f2c55090b10cf08038fcd73f7149639c687b07e3..ba9d7f0aa8a5474d1dbf1721c02620604cf795f9
@@@ -3,31 -3,29 +3,31 @@@
  #
  # Table name: statuses
  #
- #  id                     :bigint(8)        not null, primary key
- #  uri                    :string
- #  text                   :text             default(""), not null
- #  created_at             :datetime         not null
- #  updated_at             :datetime         not null
- #  in_reply_to_id         :bigint(8)
- #  reblog_of_id           :bigint(8)
- #  url                    :string
- #  sensitive              :boolean          default(FALSE), not null
- #  visibility             :integer          default("public"), not null
- #  spoiler_text           :text             default(""), not null
- #  reply                  :boolean          default(FALSE), not null
- #  language               :string
- #  conversation_id        :bigint(8)
- #  local                  :boolean
- #  account_id             :bigint(8)        not null
- #  application_id         :bigint(8)
- #  in_reply_to_account_id :bigint(8)
- #  local_only             :boolean
- #  full_status_text       :text             default(""), not null
- #  poll_id                :bigint(8)
- #  content_type           :string
- #  deleted_at             :datetime
- #  edited_at              :datetime
- #  trendable              :boolean
+ #  id                           :bigint(8)        not null, primary key
+ #  uri                          :string
+ #  text                         :text             default(""), not null
+ #  created_at                   :datetime         not null
+ #  updated_at                   :datetime         not null
+ #  in_reply_to_id               :bigint(8)
+ #  reblog_of_id                 :bigint(8)
+ #  url                          :string
+ #  sensitive                    :boolean          default(FALSE), not null
+ #  visibility                   :integer          default("public"), not null
+ #  spoiler_text                 :text             default(""), not null
+ #  reply                        :boolean          default(FALSE), not null
+ #  language                     :string
+ #  conversation_id              :bigint(8)
+ #  local                        :boolean
+ #  account_id                   :bigint(8)        not null
+ #  application_id               :bigint(8)
+ #  in_reply_to_account_id       :bigint(8)
++#  local_only                   :boolean
+ #  poll_id                      :bigint(8)
++#  content_type                 :string
+ #  deleted_at                   :datetime
+ #  edited_at                    :datetime
+ #  trendable                    :boolean
+ #  ordered_media_attachment_ids :bigint(8)        is an Array
  #
  
  class Status < ApplicationRecord
      edits.create!(
        text: text,
        spoiler_text: spoiler_text,
-       media_attachments_changed: media_attachments_changed,
+       sensitive: sensitive,
+       ordered_media_attachment_ids: ordered_media_attachment_ids || media_attachments.pluck(:id),
+       media_descriptions: ordered_media_attachments.map(&:description),
+       poll_options: preloadable_poll&.options,
        account_id: account_id || self.account_id,
-       created_at: at_time || edited_at
 +      content_type: content_type,
+       created_at: at_time || edited_at,
+       rate_limit: rate_limit
      )
    end
  
index 3d8098fe7632e7ab16f75527baba52dab9960331,e9c8fbe986f2dd72ab37356bbd377e320fc3534c..33528eb0d9a9b6f2ffedaffeac8256df872cde54
@@@ -3,15 -3,17 +3,18 @@@
  #
  # Table name: status_edits
  #
- #  id                        :bigint(8)        not null, primary key
- #  status_id                 :bigint(8)        not null
- #  account_id                :bigint(8)
- #  text                      :text             default(""), not null
- #  spoiler_text              :text             default(""), not null
- #  media_attachments_changed :boolean          default(FALSE), not null
- #  created_at                :datetime         not null
- #  updated_at                :datetime         not null
- #  content_type              :string
+ #  id                           :bigint(8)        not null, primary key
+ #  status_id                    :bigint(8)        not null
+ #  account_id                   :bigint(8)
+ #  text                         :text             default(""), not null
+ #  spoiler_text                 :text             default(""), not null
+ #  created_at                   :datetime         not null
+ #  updated_at                   :datetime         not null
++#  content_type                 :string
+ #  ordered_media_attachment_ids :bigint(8)        is an Array
+ #  media_descriptions           :text             is an Array
+ #  poll_options                 :string           is an Array
+ #  sensitive                    :boolean
  #
  
  class StatusEdit < ApplicationRecord
index aa552a7248856b949a0b7bcc0f6d6253371efb16,7be2e2647627802cfb5e2a2d6d0aaa655e9af8a3..05f2ee14f1535d1041359d199c1288f7608f7ed8
@@@ -13,9 -13,7 +13,9 @@@ class ActivityPub::NoteSerializer < Act
    attribute :content_map, if: :language?
    attribute :updated, if: :edited?
  
-   has_many :media_attachments, key: :attachment
 +  attribute :direct_message, if: :non_public?
 +
+   has_many :virtual_attachments, key: :attachment
    has_many :virtual_tags, key: :tag
  
    has_one :replies, serializer: ActivityPub::CollectionSerializer, if: :local?
    end
  
    def sensitive
 -    object.account.sensitized? || object.sensitive
 +    object.account.sensitized? || object.sensitive || (!instance_options[:allow_local_only] && Setting.outgoing_spoilers.present?)
    end
  
+   def virtual_attachments
+     object.ordered_media_attachments
+   end
    def virtual_tags
      object.active_mentions.to_a.sort_by(&:id) + object.tags + object.emojis
    end
index c5061dd635c2d90eb5a506b01e8602ff3dde26ca,c132930a98e676447d7db009f58a0ee8fe938cef..36592a531f03c6b6a997be75b200a59105e9e01c
@@@ -171,9 -166,8 +175,9 @@@ class PostStatusService < BaseServic
        sensitive: @sensitive,
        spoiler_text: @options[:spoiler_text] || '',
        visibility: @visibility,
-       language: valid_locale_or_nil(@options[:language].presence || @account.user&.preferred_posting_language || I18n.default_locale),
+       language: valid_locale_cascade(@options[:language], @account.user&.preferred_posting_language, I18n.default_locale),
        application: @options[:application],
 +      content_type: @options[:content_type] || @account.user&.setting_default_content_type,
        rate_limit: @options[:with_rate_limit],
      }.compact
    end
index 361cd4d8220c0ec37a2a70ff0cff388c25372d4a,159aec1f23d5d613b4f7b2123bcca9b059dd3990..c28e165725e18cfd0aaa6091d0edc56cec9682bd
@@@ -40,8 -40,7 +40,8 @@@ class RemoveStatusService < BaseServic
            remove_reblogs
            remove_from_hashtags
            remove_from_public
-           remove_from_media if @status.media_attachments.any?
+           remove_from_media if @status.with_media?
 +          remove_from_direct if status.direct_visibility?
            remove_media
          end
  
index 6cbbd287660d26dff6c5d6123a3607c0eeeabac5,055e5968db8248b585ea66a35ef7ac4540a4cfab..f5155a2f529cfea3eae8b815d53bb55a4883182b
@@@ -95,8 -89,7 +90,8 @@@ class UpdateStatusService < BaseServic
      @status.text         = @options[:text].presence || @options.delete(:spoiler_text) || '' if @options.key?(:text)
      @status.spoiler_text = @options[:spoiler_text] || '' if @options.key?(:spoiler_text)
      @status.sensitive    = @options[:sensitive] || @options[:spoiler_text].present? if @options.key?(:sensitive) || @options.key?(:spoiler_text)
-     @status.language     = valid_locale_or_nil(@options[:language] || @status.language || @status.account.user&.preferred_posting_language || I18n.default_locale)
+     @status.language     = valid_locale_cascade(@options[:language], @status.language, @status.account.user&.preferred_posting_language, I18n.default_locale)
 +    @status.content_type = @options[:content_type] || @status.content_type
      @status.edited_at    = Time.now.utc
  
      @status.save!
Simple merge
diff --cc db/schema.rb
index f8d85901d98b131d7900918510337d6bc2963c18,79e9b0f4dd02c5a6aa38526085957958a55045ca..3f51b85d53e232ff8e1cdb010ce2be854df1fe31
@@@ -845,10 -844,12 +844,13 @@@ ActiveRecord::Schema.define(version: 20
      t.bigint "account_id"
      t.text "text", default: "", null: false
      t.text "spoiler_text", default: "", null: false
-     t.boolean "media_attachments_changed", default: false, null: false
      t.datetime "created_at", precision: 6, null: false
      t.datetime "updated_at", precision: 6, null: false
 +    t.string "content_type"
+     t.bigint "ordered_media_attachment_ids", array: true
+     t.text "media_descriptions", array: true
+     t.string "poll_options", array: true
+     t.boolean "sensitive"
      t.index ["account_id"], name: "index_status_edits_on_account_id"
      t.index ["status_id"], name: "index_status_edits_on_status_id"
    end
diff --cc package.json
index 96aab9ef1ed16bc39510a11fecbf0b569830fe71,d9e4ee137fd2f1096f1df2786114db43a810ea88..463d47a8a2020f948cddb75c62e27ee22de2f397
@@@ -95,8 -93,7 +95,8 @@@
      "es6-symbol": "^3.1.3",
      "escape-html": "^1.0.3",
      "exif-js": "^2.3.0",
-     "express": "^4.17.1",
+     "express": "^4.17.3",
 +    "favico.js": "^0.3.10",
      "file-loader": "^6.2.0",
      "font-awesome": "^4.7.0",
      "glob": "^7.2.0",
diff --cc yarn.lock
Simple merge