Skip to content

Commit

Permalink
ローカルのみや非公開のピン留めはAP公開しないように
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Dec 2, 2023
1 parent ee8a039 commit 7a4e739
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/server/activitypub/featured.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import renderOrderedCollection from '../../remote/activitypub/renderer/ordered-c
import { setResponseType } from '../activitypub';
import renderNote from '../../remote/activitypub/renderer/note';
import { Users, Notes, UserNotePinings } from '../../models';
import { ensure } from '../../prelude/ensure';

export default async (ctx: Router.RouterContext) => {
const userId = ctx.params.user;
Expand All @@ -26,8 +25,9 @@ export default async (ctx: Router.RouterContext) => {
order: { id: 'DESC' }
});

const pinnedNotes = await Promise.all(pinings.map(pining =>
Notes.findOne(pining.noteId).then(ensure)));
const pinnedNotes = (await Promise.all(pinings.map(pining =>
Notes.findOneOrFail(pining.noteId))))
.filter(note => !note.localOnly && ['public', 'home'].includes(note.visibility));

const renderedNotes = await Promise.all(pinnedNotes.map(note => renderNote(note, false)));

Expand Down
4 changes: 2 additions & 2 deletions src/services/i/pin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export async function addPinned(user: User, noteId: Note['id']) {
} as UserNotePining);

// Deliver to remote followers
if (Users.isLocalUser(user)) {
if (Users.isLocalUser(user) && !note.localOnly && ['public', 'home'].includes(note.visibility)) {
deliverPinnedChange(user.id, note.id, true);
}
}
Expand All @@ -72,7 +72,7 @@ export async function removePinned(user: User, noteId: Note['id']) {
});

// Deliver to remote followers
if (Users.isLocalUser(user)) {
if (Users.isLocalUser(user) && !note.localOnly && ['public', 'home'].includes(note.visibility)) {
deliverPinnedChange(user.id, noteId, false);
}
}
Expand Down

0 comments on commit 7a4e739

Please # to comment.