mirror of
https://github.com/paricafe/misskey.git
synced 2024-12-12 20:26:43 -06:00
0d508db8a7
* fix(backend): check visibility of following/followers of remote users Resolves https://github.com/misskey-dev/misskey/issues/13362. * test(backend): add tests for visibility of following/followers of remote users * docs(changelog): update CHANGELOG.md * feat: moderators can see following/followers of all users * docs(changelog): update CHANGELOG.md * refactor(backend): minor refactoring `createPerson`と`if`の条件を統一するとともに、異常系の 処理をearly returnに追い出すための変更。 * feat(backend): moderators can see following/followers count of all users As per https://github.com/misskey-dev/misskey/pull/14375#issuecomment-2275044908.
24 lines
827 B
TypeScript
24 lines
827 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
import * as Misskey from 'misskey-js';
|
|
import { $i } from '@/account.js';
|
|
|
|
export function isFollowingVisibleForMe(user: Misskey.entities.UserDetailed): boolean {
|
|
if ($i && ($i.id === user.id || $i.isAdmin || $i.isModerator)) return true;
|
|
|
|
if (user.followingVisibility === 'private') return false;
|
|
if (user.followingVisibility === 'followers' && !user.isFollowing) return false;
|
|
|
|
return true;
|
|
}
|
|
export function isFollowersVisibleForMe(user: Misskey.entities.UserDetailed): boolean {
|
|
if ($i && ($i.id === user.id || $i.isAdmin || $i.isModerator)) return true;
|
|
|
|
if (user.followersVisibility === 'private') return false;
|
|
if (user.followersVisibility === 'followers' && !user.isFollowing) return false;
|
|
|
|
return true;
|
|
}
|