mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
use community outbox properly
This commit is contained in:
parent
8ce71bdd54
commit
46bca83e2a
3 changed files with 46 additions and 1 deletions
|
@ -425,6 +425,7 @@ def actor_json_to_model(activity_json, address, server):
|
||||||
ap_profile_id=activity_json['id'].lower(),
|
ap_profile_id=activity_json['id'].lower(),
|
||||||
ap_followers_url=activity_json['followers'],
|
ap_followers_url=activity_json['followers'],
|
||||||
ap_inbox_url=activity_json['endpoints']['sharedInbox'],
|
ap_inbox_url=activity_json['endpoints']['sharedInbox'],
|
||||||
|
ap_outbox_url=activity_json['outbox'],
|
||||||
ap_moderators_url=mods_url,
|
ap_moderators_url=mods_url,
|
||||||
ap_fetched_at=utcnow(),
|
ap_fetched_at=utcnow(),
|
||||||
ap_domain=server,
|
ap_domain=server,
|
||||||
|
|
|
@ -91,7 +91,7 @@ def retrieve_mods_and_backfill(community_id: int):
|
||||||
|
|
||||||
# download 50 old posts
|
# download 50 old posts
|
||||||
if community.ap_public_url:
|
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:
|
if outbox_request.status_code == 200:
|
||||||
outbox_data = outbox_request.json()
|
outbox_data = outbox_request.json()
|
||||||
outbox_request.close()
|
outbox_request.close()
|
||||||
|
|
44
migrations/versions/a937c8721612_community_outbox_url.py
Normal file
44
migrations/versions/a937c8721612_community_outbox_url.py
Normal file
|
@ -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 ###
|
Loading…
Reference in a new issue