Skip to content

Commit

Permalink
Fixed incorrect actor passed from like notifications (TryGhost#21451)
Browse files Browse the repository at this point in the history
ref https://linear.app/ghost/issue/AP-541/incorrect-object-loaded-on-like-notifications

- We were passing the wrong `actor` info from `like` notifications. We should be using `activity.object.attributedTo` instead.
  • Loading branch information
djordjevlais authored Oct 29, 2024
1 parent 71fb9f8 commit c299051
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion apps/admin-x-activitypub/src/components/Activities.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import MainNavigation from './navigation/MainNavigation';
import ViewProfileModal from './global/ViewProfileModal';

import getUsername from '../utils/get-username';
import {ActorProperties} from '@tryghost/admin-x-framework/api/activitypub';
import {useActivitiesForUser} from '../hooks/useActivityPubQueries';
// import {useFollowersForUser} from '../MainContent';

Expand Down Expand Up @@ -151,7 +152,7 @@ const Activities: React.FC<ActivitiesProps> = ({}) => {
case ACTVITY_TYPE.LIKE:
NiceModal.show(ArticleModal, {
object: activity.object,
actor: activity.actor,
actor: activity.object.attributedTo as ActorProperties,
comments: activity.object.replies
});
break;
Expand Down
4 changes: 2 additions & 2 deletions apps/admin-x-activitypub/src/components/feed/FeedItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ const FeedItem: React.FC<FeedItemProps> = ({actor, object, layout, type, comment
<div className='relative z-10 flex w-full min-w-0 flex-col overflow-visible text-[1.5rem]'>
<div className='flex w-full'>
<span className='min-w-0 truncate whitespace-nowrap font-bold after:mx-1 after:font-normal after:text-grey-700 after:content-["·"]' data-test-activity-heading>{author.name}</span>
<div className='ml-2'>{renderTimestamp(object)}</div>
<div>{renderTimestamp(object)}</div>
</div>
<div className='flex w-full'>
<span className='min-w-0 truncate text-grey-700'>{getUsername(author)}</span>
Expand Down Expand Up @@ -420,7 +420,7 @@ const FeedItem: React.FC<FeedItemProps> = ({actor, object, layout, type, comment
<div className='relative z-10 flex w-full min-w-0 flex-col overflow-visible text-[1.5rem]'>
<div className='flex'>
<span className='min-w-0 truncate whitespace-nowrap font-bold after:mx-1 after:font-normal after:text-grey-700 after:content-["·"]' data-test-activity-heading>{author.name}</span>
<div className='ml-2'>{renderTimestamp(object)}</div>
<div>{renderTimestamp(object)}</div>
</div>
<div className='flex'>
<span className='truncate text-grey-700'>{getUsername(author)}</span>
Expand Down

0 comments on commit c299051

Please sign in to comment.