5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-23 00:26:22 +00:00
panel/app/models/activity_pub/actor.rb

30 lines
727 B
Ruby
Raw Normal View History

# frozen_string_literal: true
# = Actor =
#
# Actor es la entidad que realiza acciones en ActivityPub
#
# @todo Obtener el perfil dinámicamente
2024-02-21 15:46:38 +00:00
class ActivityPub
class Actor < ApplicationRecord
include ActivityPub::Concerns::JsonLdConcern
2024-02-21 15:46:38 +00:00
belongs_to :instance
2024-02-28 20:34:34 +00:00
has_many :actor_moderation
2024-02-21 15:46:38 +00:00
has_many :activity_pubs, as: :object
has_many :activities
2024-03-01 18:04:07 +00:00
has_many :remote_flags
2024-02-28 20:58:00 +00:00
# Obtiene el nombre de la Actor como mención, solo si obtuvimos el
# contenido de antemano.
#
# @return [String, nil]
def mention
return if content['preferredUsername'].blank?
return if instance.blank?
@mention ||= "@#{content['preferredUsername']}@#{instance.hostname}"
end
2024-02-21 15:46:38 +00:00
end
end