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_remote_id
|
||||
from core.meta import by_type
|
||||
from core.meta import flag
|
||||
from core.meta import inc
|
||||
from core.meta import upsert
|
||||
from core.notifications import _NewMeta
|
||||
from core.notifications import set_inbox_flags
|
||||
from core.outbox import process_outbox
|
||||
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 p
|
||||
from core.tasks import Tasks
|
||||
from utils import now
|
||||
from utils import opengraph
|
||||
from utils.media import is_video
|
||||
|
||||
|
@ -643,12 +642,7 @@ def task_process_new_activity() -> _Response:
|
|||
activity = ap.fetch_remote_activity(iri)
|
||||
app.logger.info(f"activity={activity!r}")
|
||||
|
||||
flags = {}
|
||||
|
||||
if not activity.published:
|
||||
flags.update(flag(MetaKey.PUBLISHED, now()))
|
||||
else:
|
||||
flags.update(flag(MetaKey.PUBLISHED, activity.published))
|
||||
flags: _NewMeta = {}
|
||||
|
||||
set_inbox_flags(activity, flags)
|
||||
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),
|
||||
"remote_id": activity.id,
|
||||
"meta": {
|
||||
"undo": False,
|
||||
"deleted": False,
|
||||
"public": is_public,
|
||||
"server": urlparse(activity.id).netloc,
|
||||
"visibility": visibility.name,
|
||||
"actor_id": actor_id,
|
||||
"object_id": object_id,
|
||||
"object_visibility": object_visibility,
|
||||
"poll_answer": False,
|
||||
MetaKey.UNDO.value: False,
|
||||
MetaKey.DELETED.value: False,
|
||||
MetaKey.PUBLIC.value: is_public,
|
||||
MetaKey.SERVER.value: urlparse(activity.id).netloc,
|
||||
MetaKey.VISIBILITY.value: visibility.name,
|
||||
MetaKey.ACTOR_ID.value: actor_id,
|
||||
MetaKey.OBJECT_ID.value: object_id,
|
||||
MetaKey.OBJECT_VISIBILITY.value: object_visibility,
|
||||
MetaKey.POLL_ANSWER.value: False,
|
||||
MetaKey.PUBLISHED.value: activity.published
|
||||
if activity.published
|
||||
else now(),
|
||||
},
|
||||
}
|
||||
)
|
||||
|
|
|
@ -39,6 +39,10 @@ class MetaKey(Enum):
|
|||
PUBLIC = "public"
|
||||
THREAD_ROOT_PARENT = "thread_root_parent"
|
||||
|
||||
SERVER = "server"
|
||||
VISIBILITY = "visibility"
|
||||
OBJECT_VISIBILITY = "object_visibility"
|
||||
|
||||
DELETED = "deleted"
|
||||
BOOSTED = "boosted"
|
||||
LIKED = "liked"
|
||||
|
|
Loading…
Reference in a new issue