forked from FoundKeyGang/FoundKey
wip
This commit is contained in:
parent
7797a0746a
commit
e9940c9221
7 changed files with 63 additions and 43 deletions
|
@ -40,6 +40,7 @@
|
|||
</p>
|
||||
<div class="content" v-show="p.cw == null || showContent">
|
||||
<div class="text">
|
||||
<span v-if="p.isHidden" style="opacity: 0.5">(この投稿は非公開です)</span>
|
||||
<a class="reply" v-if="p.reply">%fa:reply%</a>
|
||||
<mk-note-html v-if="p.text" :text="p.text" :i="os.i" :class="$style.text"/>
|
||||
<a class="rp" v-if="p.renote">RP:</a>
|
||||
|
|
|
@ -291,7 +291,7 @@ export default Vue.extend({
|
|||
poll: this.poll ? (this.$refs.poll as any).get() : undefined,
|
||||
cw: this.useCw ? this.cw || '' : undefined,
|
||||
visibility: this.visibility,
|
||||
visibleUserIds: this.visibleUsers.map(u => u.id),
|
||||
visibleUserIds: this.visibility == 'specified' ? this.visibleUsers.map(u => u.id) : undefined,
|
||||
geo: this.geo ? {
|
||||
coordinates: [this.geo.longitude, this.geo.latitude],
|
||||
altitude: this.geo.altitude,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<div class="mk-sub-note-content">
|
||||
<div class="body">
|
||||
<span v-if="note.isHidden" style="opacity: 0.5">(この投稿は非公開です)</span>
|
||||
<a class="reply" v-if="note.replyId">%fa:reply%</a>
|
||||
<mk-note-html :text="note.text" :i="os.i"/>
|
||||
<a class="rp" v-if="note.renoteId" :href="`/note:${note.renoteId}`">RP: ...</a>
|
||||
|
|
|
@ -37,9 +37,8 @@
|
|||
</p>
|
||||
<div class="content" v-show="p.cw == null || showContent">
|
||||
<div class="text">
|
||||
<a class="reply" v-if="p.reply">
|
||||
%fa:reply%
|
||||
</a>
|
||||
<span v-if="p.isHidden" style="opacity: 0.5">(この投稿は非公開です)</span>
|
||||
<a class="reply" v-if="p.reply">%fa:reply%</a>
|
||||
<mk-note-html v-if="p.text" :text="p.text" :i="os.i" :class="$style.text"/>
|
||||
<a class="rp" v-if="p.renote != null">RP:</a>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<template>
|
||||
<div class="mk-sub-note-content">
|
||||
<div class="body">
|
||||
<span v-if="note.isHidden" style="opacity: 0.5">(この投稿は非公開です)</span>
|
||||
<a class="reply" v-if="note.replyId">%fa:reply%</a>
|
||||
<mk-note-html v-if="note.text" :text="note.text" :i="os.i"/>
|
||||
<a class="rp" v-if="note.renoteId">RP: ...</a>
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in a new issue