+ (この投稿は非公開です)
%fa:reply%
RP: ...
diff --git a/src/client/app/mobile/views/components/note.vue b/src/client/app/mobile/views/components/note.vue
index 3eca49a43f..5202e0eb54 100644
--- a/src/client/app/mobile/views/components/note.vue
+++ b/src/client/app/mobile/views/components/note.vue
@@ -37,9 +37,8 @@
diff --git a/src/client/app/mobile/views/components/sub-note-content.vue b/src/client/app/mobile/views/components/sub-note-content.vue
index 54cc74f7f5..cc50977a58 100644
--- a/src/client/app/mobile/views/components/sub-note-content.vue
+++ b/src/client/app/mobile/views/components/sub-note-content.vue
@@ -1,6 +1,7 @@
+ (この投稿は非公開です)
%fa:reply%
RP: ...
diff --git a/src/models/note.ts b/src/models/note.ts
index 918ef6d69e..3256a8c153 100644
--- a/src/models/note.ts
+++ b/src/models/note.ts
@@ -163,9 +163,9 @@ export const pack = async (
detail: boolean
}
) => {
- const opts = options || {
- detail: true,
- };
+ const opts = Object.assign({
+ detail: true
+ }, options);
// Me
const meId: mongo.ObjectID = me
@@ -208,7 +208,7 @@ export const pack = async (
hide = false;
} else {
// 指定されているかどうか
- const specified = _note.visibleUserIds.test(id => id.equals(meId));
+ const specified = _note.visibleUserIds.some(id => id.equals(meId));
if (specified) {
hide = false;
@@ -245,6 +245,9 @@ export const pack = async (
_note.id = _note._id;
delete _note._id;
+ delete _note._user;
+ delete _note._reply;
+ delete _note.repost;
delete _note.mentions;
if (_note.geo) delete _note.geo.type;
@@ -262,11 +265,9 @@ export const pack = async (
}
// Populate media
- if (_note.mediaIds && !hide) {
- _note.media = Promise.all(_note.mediaIds.map(fileId =>
- packFile(fileId)
- ));
- }
+ _note.media = hide ? [] : Promise.all(_note.mediaIds.map(fileId =>
+ packFile(fileId)
+ ));
// When requested a detailed note data
if (opts.detail) {
diff --git a/src/services/note/create.ts b/src/services/note/create.ts
index 2b9fb0b1d8..8d66267132 100644
--- a/src/services/note/create.ts
+++ b/src/services/note/create.ts
@@ -123,42 +123,59 @@ export default async (user: IUser, data: {
if (note.channelId == null) {
if (!silent) {
if (isLocalUser(user)) {
- // Publish event to myself's stream
- stream(note.userId, 'note', noteObj);
+ if (note.visibility == 'private') {
+ // Publish event to myself's stream
+ stream(note.userId, 'note', await pack(note, user, {
+ detail: true
+ }));
+ } else {
+ // Publish event to myself's stream
+ stream(note.userId, 'note', noteObj);
- // Publish note to local timeline stream
- publishLocalTimelineStream(noteObj);
+ // Publish note to local timeline stream
+ publishLocalTimelineStream(noteObj);
+ }
}
// Publish note to global timeline stream
publishGlobalTimelineStream(noteObj);
- // フォロワーに配信
- Following.find({
- followeeId: note.userId
- }).then(followers => {
- followers.map(async following => {
- const follower = following._follower;
-
- if (isLocalUser(follower)) {
- // ストーキングしていない場合
- if (!following.stalk) {
- // この投稿が返信ならスキップ
- if (note.replyId && !note._reply.userId.equals(following.followerId) && !note._reply.userId.equals(note.userId)) return;
- }
-
- // Publish event to followers stream
- stream(following.followerId, 'note', noteObj);
- } else {
- //#region AP配送
- // フォロワーがリモートユーザーかつ投稿者がローカルユーザーなら投稿を配信
- if (isLocalUser(user)) {
- deliver(user, await render(), follower.inbox);
- }
- //#endergion
- }
+ if (note.visibility == 'specified') {
+ data.visibleUsers.forEach(async u => {
+ stream(u._id, 'note', await pack(note, u, {
+ detail: true
+ }));
});
- });
+ }
+
+ if (note.visibility == 'public' || note.visibility == 'home' || note.visibility == 'followers') {
+ // フォロワーに配信
+ Following.find({
+ followeeId: note.userId
+ }).then(followers => {
+ followers.map(async following => {
+ const follower = following._follower;
+
+ if (isLocalUser(follower)) {
+ // ストーキングしていない場合
+ if (!following.stalk) {
+ // この投稿が返信ならスキップ
+ if (note.replyId && !note._reply.userId.equals(following.followerId) && !note._reply.userId.equals(note.userId)) return;
+ }
+
+ // Publish event to followers stream
+ stream(following.followerId, 'note', noteObj);
+ } else {
+ //#region AP配送
+ // フォロワーがリモートユーザーかつ投稿者がローカルユーザーなら投稿を配信
+ if (isLocalUser(user)) {
+ deliver(user, await render(), follower.inbox);
+ }
+ //#endergion
+ }
+ });
+ });
+ }
// リストに配信
UserList.find({
@@ -170,7 +187,7 @@ export default async (user: IUser, data: {
});
}
- //#region AP配送
+ //#region リプライとAnnounceのAP配送
const render = async () => {
const content = data.renote && data.text == null
? renderAnnounce(data.renote.uri ? data.renote.uri : await renderNote(data.renote))