diff --git a/app/activitypub/util.py b/app/activitypub/util.py index ce554c1c..735c1199 100644 --- a/app/activitypub/util.py +++ b/app/activitypub/util.py @@ -425,6 +425,7 @@ def actor_json_to_model(activity_json, address, server): ap_profile_id=activity_json['id'].lower(), ap_followers_url=activity_json['followers'], ap_inbox_url=activity_json['endpoints']['sharedInbox'], + ap_outbox_url=activity_json['outbox'], ap_moderators_url=mods_url, ap_fetched_at=utcnow(), ap_domain=server, diff --git a/app/community/util.py b/app/community/util.py index 353a1260..6a6d54b9 100644 --- a/app/community/util.py +++ b/app/community/util.py @@ -91,7 +91,7 @@ def retrieve_mods_and_backfill(community_id: int): # download 50 old posts if community.ap_public_url: - outbox_request = get_request(community.ap_public_url + '/outbox', headers={'Accept': 'application/activity+json'}) + outbox_request = get_request(community.ap_outbox_url, headers={'Accept': 'application/activity+json'}) if outbox_request.status_code == 200: outbox_data = outbox_request.json() outbox_request.close() diff --git a/migrations/versions/a937c8721612_community_outbox_url.py b/migrations/versions/a937c8721612_community_outbox_url.py new file mode 100644 index 00000000..90c986ce --- /dev/null +++ b/migrations/versions/a937c8721612_community_outbox_url.py @@ -0,0 +1,44 @@ +"""community outbox url + +Revision ID: a937c8721612 +Revises: 8ca0f0789040 +Create Date: 2024-02-21 08:14:23.088264 + +""" +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'a937c8721612' +down_revision = '8ca0f0789040' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('community', schema=None) as batch_op: + batch_op.add_column(sa.Column('ap_outbox_url', sa.String(length=255), nullable=True)) + + with op.batch_alter_table('user', schema=None) as batch_op: + batch_op.add_column(sa.Column('email_unread', sa.Boolean(), nullable=True)) + batch_op.add_column(sa.Column('email_unread_sent', sa.Boolean(), nullable=True)) + batch_op.add_column(sa.Column('email_messages', sa.Boolean(), nullable=True)) + batch_op.add_column(sa.Column('email_messages_sent', sa.Boolean(), nullable=True)) + + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + with op.batch_alter_table('user', schema=None) as batch_op: + batch_op.drop_column('email_messages_sent') + batch_op.drop_column('email_messages') + batch_op.drop_column('email_unread_sent') + batch_op.drop_column('email_unread') + + with op.batch_alter_table('community', schema=None) as batch_op: + batch_op.drop_column('ap_outbox_url') + + # ### end Alembic commands ###