Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def show
protected

def ensure_actor_exists
unless @actor = DiscourseActivityPubActor.find_by(ap_key: params[:key])
unless @actor = DiscourseActivityPubActor.includes(:model).find_by(ap_key: params[:key])
render_activity_pub_error("not_found", 404)
end
end
Expand Down
35 changes: 18 additions & 17 deletions app/models/discourse_activity_pub_actor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -390,33 +390,34 @@ def local_username_uniqueness
# Table name: discourse_activity_pub_actors
#
# id :bigint not null, primary key
# ap_id :string not null
# ap_former_type :string
# ap_key :string
# ap_type :string not null
# domain :string
# local :boolean
# available :boolean default(TRUE)
# default_visibility :string
# deleted_at :datetime
# domain :string
# enabled :boolean
# icon_url :string
# inbox :string
# outbox :string
# username :string
# name :string
# model_id :integer
# local :boolean
# model_type :string
# name :string
# outbox :string
# post_object_type :string
# private_key :text
# public_key :text
# publication_type :string
# shared_inbox :string
# username :string
# created_at :datetime not null
# updated_at :datetime not null
# icon_url :string
# shared_inbox :string
# enabled :boolean
# default_visibility :string
# publication_type :string
# post_object_type :string
# deleted_at :datetime
# ap_former_type :string
# ap_id :string not null
# model_id :integer
#
# Indexes
#
# index_discourse_activity_pub_actors_on_ap_id (ap_id) UNIQUE
# unique_activity_pub_actor_models (model_type,model_id) UNIQUE
# index_discourse_activity_pub_actors_on_ap_id (ap_id) UNIQUE
# index_discourse_activity_pub_actors_on_ap_key (ap_key) UNIQUE
# unique_activity_pub_actor_models (model_type,model_id) UNIQUE
#
6 changes: 3 additions & 3 deletions app/models/discourse_activity_pub_authorization.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ class DiscourseActivityPubAuthorization < ActiveRecord::Base
# Table name: discourse_activity_pub_authorizations
#
# id :bigint not null, primary key
# user_id :integer not null
# actor_id :bigint
# client_id :bigint
# token :string(1000)
# created_at :datetime not null
# updated_at :datetime not null
# actor_id :bigint
# client_id :bigint
# user_id :integer not null
#
# Indexes
#
Expand Down
2 changes: 1 addition & 1 deletion app/models/discourse_activity_pub_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def verify_credentials
#
# id :bigint not null, primary key
# auth_type :integer not null
# domain :string(1000) not null
# credentials :json not null
# domain :string(1000) not null
# created_at :datetime not null
# updated_at :datetime not null
#
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true
class AddIndexToDiscourseActivityPubActorsApKey < ActiveRecord::Migration[7.2]
def change
add_index :discourse_activity_pub_actors, :ap_key, unique: true
end
end