diff --git a/apps/admin-x-activitypub/package.json b/apps/admin-x-activitypub/package.json
index 00b4f5dec7..6f6b49c59b 100644
--- a/apps/admin-x-activitypub/package.json
+++ b/apps/admin-x-activitypub/package.json
@@ -1,6 +1,6 @@
{
"name": "@tryghost/admin-x-activitypub",
- "version": "0.3.35",
+ "version": "0.3.36",
"license": "MIT",
"repository": {
"type": "git",
diff --git a/apps/admin-x-activitypub/src/components/Activities.tsx b/apps/admin-x-activitypub/src/components/Activities.tsx
index 9a86906c25..97e167fc53 100644
--- a/apps/admin-x-activitypub/src/components/Activities.tsx
+++ b/apps/admin-x-activitypub/src/components/Activities.tsx
@@ -9,14 +9,13 @@ import ArticleModal from './feed/ArticleModal';
import MainNavigation from './navigation/MainNavigation';
import NotificationItem from './activities/NotificationItem';
import Separator from './global/Separator';
-import ViewProfileModal from './modals/ViewProfileModal';
import getUsername from '../utils/get-username';
import stripHtml from '../utils/strip-html';
import truncate from '../utils/truncate';
import {GET_ACTIVITIES_QUERY_KEY_NOTIFICATIONS, useActivitiesForUser} from '../hooks/useActivityPubQueries';
import {type NotificationType} from './activities/NotificationIcon';
-import {useRouting} from '@tryghost/admin-x-framework/routing';
+import {handleProfileClick} from '../utils/handle-profile-click';
interface ActivitiesProps {}
@@ -39,15 +38,15 @@ const getExtendedDescription = (activity: GroupedActivity): JSX.Element | null =
if (Boolean(activity.type === ACTIVITY_TYPE.CREATE && activity.object?.inReplyTo)) {
return (
);
} else if (activity.type === ACTIVITY_TYPE.LIKE && !activity.object?.name && activity.object?.content) {
return (
);
}
@@ -114,53 +113,39 @@ const groupActivities = (activities: Activity[]): GroupedActivity[] => {
};
const getGroupDescription = (group: GroupedActivity): JSX.Element => {
- const actorNames = group.actors.map(actor => actor.name);
- const [firstActor, secondActor, ...otherActors] = actorNames;
+ const [firstActor, secondActor, ...otherActors] = group.actors;
const hasOthers = otherActors.length > 0;
- let actorText = <>>;
+ const actorClass = 'cursor-pointer font-semibold hover:underline';
+
+ const actorText = (
+ <>
+ handleProfileClick(firstActor, e)}
+ >{firstActor.name}
+ {secondActor && (
+ <>
+ {hasOthers ? ', ' : ' and '}
+ handleProfileClick(secondActor, e)}
+ >{secondActor.name}
+ >
+ )}
+ {hasOthers && ' and others'}
+ >
+ );
switch (group.type) {
case ACTIVITY_TYPE.FOLLOW:
- actorText = (
- <>
- {firstActor}
- {secondActor && ` and `}
- {secondActor && {secondActor}}
- {hasOthers && ' and others'}
- >
- );
-
- return (
- <>
- {actorText} started following you
- >
- );
+ return <>{actorText} started following you>;
case ACTIVITY_TYPE.LIKE:
- const postType = group.object?.type === 'Article' ? 'post' : 'note';
- actorText = (
- <>
- {firstActor}
- {secondActor && (
- <>
- {hasOthers ? ', ' : ' and '}
- {secondActor}
- >
- )}
- {hasOthers && ' and others'}
- >
- );
-
- return (
- <>
- {actorText} liked your {postType}{' '}
- {group.object?.name || ''}
- >
- );
+ return <>{actorText} liked your post {group.object?.name || ''}>;
case ACTIVITY_TYPE.CREATE:
if (group.object?.inReplyTo && typeof group.object?.inReplyTo !== 'string') {
const content = stripHtml(group.object.inReplyTo.name);
- return <>{group.actors[0].name} replied to your post {truncate(content, 80)}>;
+ return <>{actorText} replied to your post {truncate(content, 80)}>;
}
}
return <>>;
@@ -179,8 +164,6 @@ const Activities: React.FC = ({}) => {
const maxAvatars = 5;
- const {updateRoute} = useRouting();
-
const {getActivitiesQuery} = useActivitiesForUser({
handle: user,
includeOwn: true,
@@ -190,6 +173,7 @@ const Activities: React.FC = ({}) => {
},
key: GET_ACTIVITIES_QUERY_KEY_NOTIFICATIONS
});
+
const {data, fetchNextPage, hasNextPage, isFetchingNextPage, isLoading} = getActivitiesQuery;
const groupedActivities = (data?.pages.flatMap((page) => {
const filtered = page.data.filter((activity, index, self) => index === self.findIndex(a => a.id === activity.id));
@@ -222,7 +206,7 @@ const Activities: React.FC = ({}) => {
};
}, [hasNextPage, isFetchingNextPage, fetchNextPage]);
- const handleActivityClick = (group: GroupedActivity) => {
+ const handleActivityClick = (group: GroupedActivity, index: number) => {
switch (group.type) {
case ACTIVITY_TYPE.CREATE:
NiceModal.show(ArticleModal, {
@@ -238,16 +222,14 @@ const Activities: React.FC = ({}) => {
activityId: group.id,
object: group.object,
actor: group.object.attributedTo as ActorProperties,
- width: 'wide'
+ width: group.object?.type === 'Article' ? 'wide' : 'narrow'
});
break;
case ACTIVITY_TYPE.FOLLOW:
if (group.actors.length > 1) {
- updateRoute('profile');
+ toggleOpen(group.id || `${group.type}_${index}`);
} else {
- NiceModal.show(ViewProfileModal, {
- profile: getUsername(group.actors[0])
- });
+ handleProfileClick(group.actors[0]);
}
break;
}
@@ -278,7 +260,7 @@ const Activities: React.FC = ({}) => {
handleActivityClick(group)}
+ onClick={() => handleActivityClick(group, index)}
>
@@ -301,7 +283,7 @@ const Activities: React.FC = ({}) => {
{group.actors.length > 1 && (