]> cat aescling's git repositories - mastodon.git/commitdiff
Merge branch 'main' into glitch-soc/merge-upstream
authorClaire <claire.github-309c@sitedethib.com>
Sat, 26 Mar 2022 18:18:55 +0000 (19:18 +0100)
committerClaire <claire.github-309c@sitedethib.com>
Sat, 26 Mar 2022 18:18:55 +0000 (19:18 +0100)
Conflicts:
- `app/lib/formatter.rb`:
  Upstream completely refactored the formatting code and removed that file,
  while glitch-soc had code for Markdown and HTML toots.
  Took upstream code, glitch-soc changes will be re-implemented on top of the
  refactored classes in a later commit.
- `app/models/status.rb`:
  Upstream refactored status edit handling and moved code to
  `app/models/concerns/status_snapshot_concern.rb`.
  Applied glitch-soc's changes to that file.
- `app/serializers/activitypub/note_serializer.rb`:
  Not really a conflict, just a line added too close to one modified by
  glitch-soc.
  Applied upstream changes while keeping the glitch-soc-modified one.
- `app/services/update_status_service.rb`:
  Not really a conflict, upstream modified a line adjacent to one added by
  glitch-soc.
  Applied upstream changes while keeping the glitch-soc line.
- `app/views/statuses/_simple_status.html.haml`:
  Upstream refactored formatting, glitch-soc changed the markup slightly.
  Applied upstream changes.
- `spec/lib/formatter_spec.rb`:
  Upstream completely refactored the formatting code and removed that file,
  while glitch-soc had code for Markdown and HTML toots.
  Took upstream code, glitch-soc changes will be re-implemented on top of the
  refactored classes in a later commit.

20 files changed:
1  2 
app/helpers/accounts_helper.rb
app/helpers/application_helper.rb
app/javascript/mastodon/locales/ja.json
app/lib/activitypub/activity/create.rb
app/lib/feed_manager.rb
app/models/account.rb
app/models/concerns/status_snapshot_concern.rb
app/models/media_attachment.rb
app/models/status.rb
app/models/user.rb
app/serializers/activitypub/note_serializer.rb
app/serializers/rest/account_serializer.rb
app/serializers/rest/status_serializer.rb
app/services/update_status_service.rb
app/views/admin/instances/show.html.haml
app/views/admin/reports/show.html.haml
app/views/admin/tags/show.html.haml
app/views/directories/index.html.haml
app/views/statuses/_simple_status.html.haml
lib/mastodon/version.rb

Simple merge
Simple merge
Simple merge
Simple merge
index 0000000000000000000000000000000000000000,9741b9aeb29539568190857b37e237c9e1b1db05..c728db7c3133fb3c3ca1311546e4b3a886a5ad0d
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,35 +1,36 @@@
+ # frozen_string_literal: true
+ module StatusSnapshotConcern
+   extend ActiveSupport::Concern
+   included do
+     has_many :edits, class_name: 'StatusEdit', inverse_of: :status, dependent: :destroy
+   end
+   def edited?
+     edited_at.present?
+   end
+   def build_snapshot(account_id: nil, at_time: nil, rate_limit: true)
+     # We don't use `edits#new` here to avoid it having saved when the
+     # status is saved, since we want to control that manually
+     StatusEdit.new(
+       status_id: id,
+       text: text,
+       spoiler_text: spoiler_text,
+       sensitive: sensitive,
+       ordered_media_attachment_ids: ordered_media_attachment_ids&.dup || media_attachments.pluck(:id),
+       media_descriptions: ordered_media_attachments.map(&:description),
+       poll_options: preloadable_poll&.options&.dup,
+       account_id: account_id || self.account_id,
++      content_type: content_type,
+       created_at: at_time || edited_at,
+       rate_limit: rate_limit
+     )
+   end
+   def snapshot!(**options)
+     build_snapshot(**options).save!
+   end
+ end
Simple merge
Simple merge
index f657f1b278a772753739eb162da0807ecf6399eb,f2d9c49eb973fbf14dcbaf3169f7f97529d113c1..7c9ced6aed9a616d67727003b8346099784a3ffd
@@@ -205,11 -205,15 +205,15 @@@ class User < ApplicationRecor
    end
  
    def functional?
 -    confirmed? && approved? && !disabled? && !account.suspended? && !account.memorial? && account.moved_to_account_id.nil?
 +    confirmed? && approved? && !disabled? && !account.suspended? && !account.memorial?
    end
  
+   def unconfirmed?
+     !confirmed?
+   end
    def unconfirmed_or_pending?
-     !(confirmed? && approved?)
+     unconfirmed? || pending?
    end
  
    def inactive_message
index 05f2ee14f1535d1041359d199c1288f7608f7ed8,27e058199d6facd85b223ee374a70b5667f7e90f..ca067ed9b55ffac67094e5fc3c047d8420d7d093
@@@ -1,7 -1,9 +1,9 @@@
  # frozen_string_literal: true
  
  class ActivityPub::NoteSerializer < ActivityPub::Serializer
 -  context_extensions :atom_uri, :conversation, :sensitive, :voters_count
+   include FormattingHelper
 +  context_extensions :atom_uri, :conversation, :sensitive, :voters_count, :direct_message
  
    attributes :id, :type, :summary,
               :in_reply_to, :published, :url,
index f5155a2f529cfea3eae8b815d53bb55a4883182b,c4c9349761cabefe92af11efdc62219f3f8300a8..cc4ec670d108b30e5897a3bc90cae43afb3dd354
@@@ -91,9 -103,11 +104,12 @@@ class UpdateStatusService < BaseServic
      @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_cascade(@options[:language], @status.language, @status.account.user&.preferred_posting_language, I18n.default_locale)
-     @status.edited_at    = Time.now.utc
 +    @status.content_type = @options[:content_type] || @status.content_type
  
+     # We raise here to rollback the entire transaction
+     raise NoChangesSubmittedError unless significant_changes?
+     @status.edited_at = Time.now.utc
      @status.save!
    end
  
Simple merge
Simple merge
index a41656323adcf5cabdcb57ee67ea12df3026d94a,13b6613ce04c14017d89a04416fac659fb867724..7b672bda749bc9da250ab23a23e878dfbd2ab59f
    .status__content.emojify{ :data => ({ spoiler: current_account&.user&.setting_expand_spoilers ? 'expanded' : 'folded' } if status.spoiler_text?) }<
      - if status.spoiler_text?
        %p<
-         %span.p-summary> #{Formatter.instance.format_spoiler(status, autoplay: prefers_autoplay?)}&nbsp;
+         %span.p-summary> #{prerender_custom_emojis(h(status.spoiler_text), status.emojis)}&nbsp;
          %button.status__content__spoiler-link= t('statuses.show_more')
 -    .e-content
 +    .e-content<
-       = Formatter.instance.format(status, custom_emojify: true, autoplay: prefers_autoplay?)
+       = prerender_custom_emojis(status_content_format(status), status.emojis)
        - if status.preloadable_poll
          = render_poll_component(status)
  
Simple merge