<commit_before># frozen_string_literal: true

class ActivityPub::ActivitySerializer < ActiveModel::Serializer
  attributes :id, :type, :actor, :published, :to, :cc

  has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer

  def id
    [ActivityPub::TagManager.instance.activity_uri_for(object)].join
  end

  def type
    announce? ? 'Announce' : 'Create'
  end

  def actor
    ActivityPub::TagManager.instance.uri_for(object.account)
  end

  def published
    object.created_at.iso8601
  end

  def to
    ActivityPub::TagManager.instance.to(object)
  end

  def cc
    ActivityPub::TagManager.instance.cc(object)
  end

  def announce?
    object.reblog?
  end
end<commit_msg>Fix #5178 - Use object URI only in Announce, instead of embedding (#5266)<commit_after># frozen_string_literal: true

class ActivityPub::ActivitySerializer < ActiveModel::Serializer
  attributes :id, :type, :actor, :published, :to, :cc

  has_one :proper, key: :object, serializer: ActivityPub::NoteSerializer, unless: :announce?
  attribute :proper_uri, key: :object, if: :announce?

  def id
    ActivityPub::TagManager.instance.activity_uri_for(object)
  end

  def type
    announce? ? 'Announce' : 'Create'
  end

  def actor
    ActivityPub::TagManager.instance.uri_for(object.account)
  end

  def published
    object.created_at.iso8601
  end

  def to
    ActivityPub::TagManager.instance.to(object)
  end

  def cc
    ActivityPub::TagManager.instance.cc(object)
  end

  def proper_uri
    ActivityPub::TagManager.instance.uri_for(object.proper)
  end

  def announce?
    object.reblog?
  end
end
{'fraction_non_alphanumeric': 0.09968847352024922, 'fraction_numerical': 0.009968847352024923, 'mean_word_length': 4.231270358306189, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3948691', 'n_tokens_mistral': 540, 'n_tokens_neox': 509, 'n_words': 122}