summaryrefslogtreecommitdiff
path: root/src/remote
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2018-08-14 01:36:56 +0900
committerGitHub <noreply@github.com>2018-08-14 01:36:56 +0900
commit131a454e7c96d6a3a67336d45a022c045fd880d8 (patch)
treee134d54040c897ce39026a598d69d0ab70d495a0 /src/remote
parent5.23.0 (diff)
parentActivityPub visibility on send (diff)
downloadmisskey-131a454e7c96d6a3a67336d45a022c045fd880d8.tar.gz
misskey-131a454e7c96d6a3a67336d45a022c045fd880d8.tar.bz2
misskey-131a454e7c96d6a3a67336d45a022c045fd880d8.zip
Merge pull request #2190 from mei23/mei-apsendvis2
ActivityPub送信時の公開範囲の実装
Diffstat (limited to 'src/remote')
-rw-r--r--src/remote/activitypub/renderer/note.ts20
-rw-r--r--src/remote/activitypub/renderer/person.ts2
2 files changed, 18 insertions, 4 deletions
diff --git a/src/remote/activitypub/renderer/note.ts b/src/remote/activitypub/renderer/note.ts
index 7cee2be22c..209e743927 100644
--- a/src/remote/activitypub/renderer/note.ts
+++ b/src/remote/activitypub/renderer/note.ts
@@ -50,9 +50,21 @@ export default async function renderNote(note: INote, dive = true): Promise<any>
? note.mentionedRemoteUsers.map(x => x.uri)
: [];
- const cc = ['public', 'home', 'followers'].includes(note.visibility)
- ? [`${attributedTo}/followers`].concat(mentions)
- : [];
+ let to: string[] = [];
+ let cc: string[] = [];
+
+ if (note.visibility == 'public') {
+ to = ['https://www.w3.org/ns/activitystreams#Public'];
+ cc = [`${attributedTo}/followers`].concat(mentions);
+ } else if (note.visibility == 'home') {
+ to = [`${attributedTo}/followers`];
+ cc = ['https://www.w3.org/ns/activitystreams#Public'].concat(mentions);
+ } else if (note.visibility == 'followers') {
+ to = [`${attributedTo}/followers`];
+ cc = mentions;
+ } else {
+ to = mentions;
+ }
const mentionedUsers = note.mentions ? await User.find({
_id: {
@@ -74,7 +86,7 @@ export default async function renderNote(note: INote, dive = true): Promise<any>
summary: note.cw,
content: toHtml(note),
published: note.createdAt.toISOString(),
- to: 'https://www.w3.org/ns/activitystreams#Public',
+ to,
cc,
inReplyTo,
attachment: (await promisedFiles).map(renderDocument),
diff --git a/src/remote/activitypub/renderer/person.ts b/src/remote/activitypub/renderer/person.ts
index 7d828f97ae..0d227303c0 100644
--- a/src/remote/activitypub/renderer/person.ts
+++ b/src/remote/activitypub/renderer/person.ts
@@ -19,6 +19,8 @@ export default async (user: ILocalUser) => {
id,
inbox: `${id}/inbox`,
outbox: `${id}/outbox`,
+ followers: `${id}/followers`,
+ following: `${id}/following`,
sharedInbox: `${config.url}/inbox`,
url: `${config.url}/@${user.username}`,
preferredUsername: user.username,