diff --git a/apps/admin-x-activitypub/src/components/Inbox.tsx b/apps/admin-x-activitypub/src/components/Inbox.tsx index 8bf95cbf9a..75506eb9f4 100644 --- a/apps/admin-x-activitypub/src/components/Inbox.tsx +++ b/apps/admin-x-activitypub/src/components/Inbox.tsx @@ -53,6 +53,30 @@ const Inbox: React.FC = ({}) => { NiceModal.show(ArticleModal, {object, actor, comments, allComments: commentsMap}); }; + function getContentAuthor(activity: Activity) { + const actor = activity.actor; + const attributedTo = activity.object.attributedTo; + + if (!attributedTo) { + return actor; + } + + if (typeof attributedTo === 'string') { + return actor; + } + + if (Array.isArray(attributedTo)) { + const found = attributedTo.find(item => typeof item !== 'string'); + if (found) { + return found; + } else { + return actor; + } + } + + return attributedTo; + } + const handleLayoutChange = (newLayout: string) => { setLayout(newLayout); }; @@ -70,7 +94,7 @@ const Inbox: React.FC = ({}) => { data-test-view-article onClick={() => handleViewContent( activity.object, - activity.actor, + getContentAuthor(activity), getCommentsForObject(activity.object.id) )} >