-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: PersonのserchableByが正しく連合できていないのを修正 (#556)
- Loading branch information
1 parent
f918b11
commit e6eec4c
Showing
7 changed files
with
60 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/backend/src/core/activitypub/misc/searchableBy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* SPDX-FileCopyrightText: syuilo and misskey-project, yojo-art team | ||
* SPDX-License-Identifier: AGPL-3.0-only | ||
*/ | ||
|
||
export function parseSearchableByFromTags(tags: string[]): 'public' | 'followersAndReacted' | 'reactedOnly' | 'private' | null { | ||
if (tags.includes('searchable_by_all_users')) return 'public'; | ||
if (tags.includes('searchable_by_followers_only')) return 'followersAndReacted'; | ||
if (tags.includes('searchable_by_reacted_users_only')) return 'followersAndReacted'; | ||
if (tags.includes('searchable_by_nobody')) return 'private'; | ||
return null; | ||
} | ||
|
||
export function parseSearchableByFromProperty (uri: string, followersUri?: string, searchableBy?: string[]): 'public' | 'followersAndReacted' | 'reactedOnly' | 'private' | null { | ||
if (!searchableBy) { | ||
return null; | ||
} | ||
|
||
if (searchableBy.includes('https://www.w3.org/ns/activitystreams#Public')) { | ||
return 'public'; | ||
} else if (followersUri && searchableBy.includes(followersUri)) { | ||
return 'followersAndReacted'; | ||
} else if (searchableBy.includes(uri)) { | ||
return 'reactedOnly'; | ||
} else if (searchableBy.includes('as:Limited') || searchableBy.includes('kmyblue:Limited')) { | ||
return 'private'; | ||
} | ||
return null; | ||
} | ||
|
||
export function toSerchableByProperty (configUrl: string, userId: string, serchableType: 'public' | 'followersAndReacted' | 'reactedOnly' | 'private' | null) : string[] | null { | ||
switch (serchableType) { | ||
case 'public' : | ||
return ['https://www.w3.org/ns/activitystreams#Public']; | ||
case 'followersAndReacted' : | ||
return [`${configUrl}/${userId}/followers`]; | ||
case 'reactedOnly' : | ||
return [`${configUrl}/users/${userId}`]; | ||
case 'private' : | ||
return ['as:Limited', 'kmyblue:Limited']; | ||
default : | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters