mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 05:36:21 +00:00
feat: relacionar actividades con instancias de origen
This commit is contained in:
parent
380d484c00
commit
64cef8a13e
4 changed files with 23 additions and 6 deletions
|
@ -7,10 +7,8 @@ class ModerationQueueController < ApplicationController
|
||||||
dummy_data
|
dummy_data
|
||||||
|
|
||||||
# @todo cambiar el estado por query
|
# @todo cambiar el estado por query
|
||||||
@activity_pubs = site.activity_pubs.where(aasm_state: 'paused')
|
@activity_pubs = site.activity_pubs
|
||||||
@activities = ActivityPub::Activity.where(activity_pub_id: @activity_pubs.pluck(:id))
|
@instances = ActivityPub::Instance.where(id: @activity_pubs.distinct.pluck(:instance_id))
|
||||||
@actors = ActivityPub::Actor.where(id: @activities.unscoped.distinct.pluck(:actor_id))
|
|
||||||
@instances = ActivityPub::Instance.where(id: @actors.distinct.pluck(:instance_id))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Perfil remoto de usuarie
|
# Perfil remoto de usuarie
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
class ActivityPub < ApplicationRecord
|
class ActivityPub < ApplicationRecord
|
||||||
include AASM
|
include AASM
|
||||||
|
|
||||||
|
belongs_to :instance
|
||||||
belongs_to :site
|
belongs_to :site
|
||||||
belongs_to :object, polymorphic: true
|
belongs_to :object, polymorphic: true
|
||||||
has_many :activities
|
has_many :activities
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Relaciona instancias con sus actividades
|
||||||
|
class AddInstanceIdToActivityPubs < ActiveRecord::Migration[6.1]
|
||||||
|
def up
|
||||||
|
add_column :activity_pubs, :instance_id, :uuid, index: true
|
||||||
|
|
||||||
|
ActivityPub.all.find_each do |activity_pub|
|
||||||
|
activity_pub.update(instance: activity_pub&.object&.actor&.instance)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
remove_column :activity_pubs, :instance_id, :uuid, index: true
|
||||||
|
end
|
||||||
|
end
|
|
@ -541,7 +541,8 @@ CREATE TABLE public.activity_pubs (
|
||||||
site_id bigint NOT NULL,
|
site_id bigint NOT NULL,
|
||||||
object_id uuid NOT NULL,
|
object_id uuid NOT NULL,
|
||||||
object_type character varying NOT NULL,
|
object_type character varying NOT NULL,
|
||||||
aasm_state character varying NOT NULL
|
aasm_state character varying NOT NULL,
|
||||||
|
instance_id uuid
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -2474,6 +2475,7 @@ INSERT INTO "schema_migrations" (version) VALUES
|
||||||
('20240219204224'),
|
('20240219204224'),
|
||||||
('20240220161414'),
|
('20240220161414'),
|
||||||
('20240221184007'),
|
('20240221184007'),
|
||||||
('20240223170317');
|
('20240223170317'),
|
||||||
|
('20240226133022');
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue