Fix the published flag for outbox activities
This commit is contained in:
parent
40c7f4c7f0
commit
5dd6385fe6
3 changed files with 18 additions and 17 deletions
|
@ -32,9 +32,9 @@ from core.meta import MetaKey
|
||||||
from core.meta import by_object_id
|
from core.meta import by_object_id
|
||||||
from core.meta import by_remote_id
|
from core.meta import by_remote_id
|
||||||
from core.meta import by_type
|
from core.meta import by_type
|
||||||
from core.meta import flag
|
|
||||||
from core.meta import inc
|
from core.meta import inc
|
||||||
from core.meta import upsert
|
from core.meta import upsert
|
||||||
|
from core.notifications import _NewMeta
|
||||||
from core.notifications import set_inbox_flags
|
from core.notifications import set_inbox_flags
|
||||||
from core.outbox import process_outbox
|
from core.outbox import process_outbox
|
||||||
from core.remote import track_failed_send
|
from core.remote import track_failed_send
|
||||||
|
@ -44,7 +44,6 @@ from core.shared import _Response
|
||||||
from core.shared import back
|
from core.shared import back
|
||||||
from core.shared import p
|
from core.shared import p
|
||||||
from core.tasks import Tasks
|
from core.tasks import Tasks
|
||||||
from utils import now
|
|
||||||
from utils import opengraph
|
from utils import opengraph
|
||||||
from utils.media import is_video
|
from utils.media import is_video
|
||||||
|
|
||||||
|
@ -643,12 +642,7 @@ def task_process_new_activity() -> _Response:
|
||||||
activity = ap.fetch_remote_activity(iri)
|
activity = ap.fetch_remote_activity(iri)
|
||||||
app.logger.info(f"activity={activity!r}")
|
app.logger.info(f"activity={activity!r}")
|
||||||
|
|
||||||
flags = {}
|
flags: _NewMeta = {}
|
||||||
|
|
||||||
if not activity.published:
|
|
||||||
flags.update(flag(MetaKey.PUBLISHED, now()))
|
|
||||||
else:
|
|
||||||
flags.update(flag(MetaKey.PUBLISHED, activity.published))
|
|
||||||
|
|
||||||
set_inbox_flags(activity, flags)
|
set_inbox_flags(activity, flags)
|
||||||
app.logger.info(f"a={activity}, flags={flags!r}")
|
app.logger.info(f"a={activity}, flags={flags!r}")
|
||||||
|
|
|
@ -123,15 +123,18 @@ def save(box: Box, activity: ap.BaseActivity) -> None:
|
||||||
"type": _to_list(activity.type),
|
"type": _to_list(activity.type),
|
||||||
"remote_id": activity.id,
|
"remote_id": activity.id,
|
||||||
"meta": {
|
"meta": {
|
||||||
"undo": False,
|
MetaKey.UNDO.value: False,
|
||||||
"deleted": False,
|
MetaKey.DELETED.value: False,
|
||||||
"public": is_public,
|
MetaKey.PUBLIC.value: is_public,
|
||||||
"server": urlparse(activity.id).netloc,
|
MetaKey.SERVER.value: urlparse(activity.id).netloc,
|
||||||
"visibility": visibility.name,
|
MetaKey.VISIBILITY.value: visibility.name,
|
||||||
"actor_id": actor_id,
|
MetaKey.ACTOR_ID.value: actor_id,
|
||||||
"object_id": object_id,
|
MetaKey.OBJECT_ID.value: object_id,
|
||||||
"object_visibility": object_visibility,
|
MetaKey.OBJECT_VISIBILITY.value: object_visibility,
|
||||||
"poll_answer": False,
|
MetaKey.POLL_ANSWER.value: False,
|
||||||
|
MetaKey.PUBLISHED.value: activity.published
|
||||||
|
if activity.published
|
||||||
|
else now(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -39,6 +39,10 @@ class MetaKey(Enum):
|
||||||
PUBLIC = "public"
|
PUBLIC = "public"
|
||||||
THREAD_ROOT_PARENT = "thread_root_parent"
|
THREAD_ROOT_PARENT = "thread_root_parent"
|
||||||
|
|
||||||
|
SERVER = "server"
|
||||||
|
VISIBILITY = "visibility"
|
||||||
|
OBJECT_VISIBILITY = "object_visibility"
|
||||||
|
|
||||||
DELETED = "deleted"
|
DELETED = "deleted"
|
||||||
BOOSTED = "boosted"
|
BOOSTED = "boosted"
|
||||||
LIKED = "liked"
|
LIKED = "liked"
|
||||||
|
|
Loading…
Reference in a new issue