This commit is contained in:
syuilo 2018-04-29 07:01:47 +09:00
parent 7797a0746a
commit e9940c9221
7 changed files with 63 additions and 43 deletions

View file

@ -40,6 +40,7 @@
</p> </p>
<div class="content" v-show="p.cw == null || showContent"> <div class="content" v-show="p.cw == null || showContent">
<div class="text"> <div class="text">
<span v-if="p.isHidden" style="opacity: 0.5">(この投稿は非公開です)</span>
<a class="reply" v-if="p.reply">%fa:reply%</a> <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"/> <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> <a class="rp" v-if="p.renote">RP:</a>

View file

@ -291,7 +291,7 @@ export default Vue.extend({
poll: this.poll ? (this.$refs.poll as any).get() : undefined, poll: this.poll ? (this.$refs.poll as any).get() : undefined,
cw: this.useCw ? this.cw || '' : undefined, cw: this.useCw ? this.cw || '' : undefined,
visibility: this.visibility, visibility: this.visibility,
visibleUserIds: this.visibleUsers.map(u => u.id), visibleUserIds: this.visibility == 'specified' ? this.visibleUsers.map(u => u.id) : undefined,
geo: this.geo ? { geo: this.geo ? {
coordinates: [this.geo.longitude, this.geo.latitude], coordinates: [this.geo.longitude, this.geo.latitude],
altitude: this.geo.altitude, altitude: this.geo.altitude,

View file

@ -1,6 +1,7 @@
<template> <template>
<div class="mk-sub-note-content"> <div class="mk-sub-note-content">
<div class="body"> <div class="body">
<span v-if="note.isHidden" style="opacity: 0.5">(この投稿は非公開です)</span>
<a class="reply" v-if="note.replyId">%fa:reply%</a> <a class="reply" v-if="note.replyId">%fa:reply%</a>
<mk-note-html :text="note.text" :i="os.i"/> <mk-note-html :text="note.text" :i="os.i"/>
<a class="rp" v-if="note.renoteId" :href="`/note:${note.renoteId}`">RP: ...</a> <a class="rp" v-if="note.renoteId" :href="`/note:${note.renoteId}`">RP: ...</a>

View file

@ -37,9 +37,8 @@
</p> </p>
<div class="content" v-show="p.cw == null || showContent"> <div class="content" v-show="p.cw == null || showContent">
<div class="text"> <div class="text">
<a class="reply" v-if="p.reply"> <span v-if="p.isHidden" style="opacity: 0.5">(この投稿は非公開です)</span>
%fa:reply% <a class="reply" v-if="p.reply">%fa:reply%</a>
</a>
<mk-note-html v-if="p.text" :text="p.text" :i="os.i" :class="$style.text"/> <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> <a class="rp" v-if="p.renote != null">RP:</a>
</div> </div>

View file

@ -1,6 +1,7 @@
<template> <template>
<div class="mk-sub-note-content"> <div class="mk-sub-note-content">
<div class="body"> <div class="body">
<span v-if="note.isHidden" style="opacity: 0.5">(この投稿は非公開です)</span>
<a class="reply" v-if="note.replyId">%fa:reply%</a> <a class="reply" v-if="note.replyId">%fa:reply%</a>
<mk-note-html v-if="note.text" :text="note.text" :i="os.i"/> <mk-note-html v-if="note.text" :text="note.text" :i="os.i"/>
<a class="rp" v-if="note.renoteId">RP: ...</a> <a class="rp" v-if="note.renoteId">RP: ...</a>

View file

@ -163,9 +163,9 @@ export const pack = async (
detail: boolean detail: boolean
} }
) => { ) => {
const opts = options || { const opts = Object.assign({
detail: true, detail: true
}; }, options);
// Me // Me
const meId: mongo.ObjectID = me const meId: mongo.ObjectID = me
@ -208,7 +208,7 @@ export const pack = async (
hide = false; hide = false;
} else { } else {
// 指定されているかどうか // 指定されているかどうか
const specified = _note.visibleUserIds.test(id => id.equals(meId)); const specified = _note.visibleUserIds.some(id => id.equals(meId));
if (specified) { if (specified) {
hide = false; hide = false;
@ -245,6 +245,9 @@ export const pack = async (
_note.id = _note._id; _note.id = _note._id;
delete _note._id; delete _note._id;
delete _note._user;
delete _note._reply;
delete _note.repost;
delete _note.mentions; delete _note.mentions;
if (_note.geo) delete _note.geo.type; if (_note.geo) delete _note.geo.type;
@ -262,11 +265,9 @@ export const pack = async (
} }
// Populate media // Populate media
if (_note.mediaIds && !hide) { _note.media = hide ? [] : Promise.all(_note.mediaIds.map(fileId =>
_note.media = Promise.all(_note.mediaIds.map(fileId =>
packFile(fileId) packFile(fileId)
)); ));
}
// When requested a detailed note data // When requested a detailed note data
if (opts.detail) { if (opts.detail) {

View file

@ -123,16 +123,32 @@ export default async (user: IUser, data: {
if (note.channelId == null) { if (note.channelId == null) {
if (!silent) { if (!silent) {
if (isLocalUser(user)) { if (isLocalUser(user)) {
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 // Publish event to myself's stream
stream(note.userId, 'note', noteObj); stream(note.userId, 'note', noteObj);
// Publish note to local timeline stream // Publish note to local timeline stream
publishLocalTimelineStream(noteObj); publishLocalTimelineStream(noteObj);
} }
}
// Publish note to global timeline stream // Publish note to global timeline stream
publishGlobalTimelineStream(noteObj); publishGlobalTimelineStream(noteObj);
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({ Following.find({
followeeId: note.userId followeeId: note.userId
@ -159,6 +175,7 @@ export default async (user: IUser, data: {
} }
}); });
}); });
}
// リストに配信 // リストに配信
UserList.find({ UserList.find({
@ -170,7 +187,7 @@ export default async (user: IUser, data: {
}); });
} }
//#region AP配送 //#region リプライとAnnounceのAP配送
const render = async () => { const render = async () => {
const content = data.renote && data.text == null const content = data.renote && data.text == null
? renderAnnounce(data.renote.uri ? data.renote.uri : await renderNote(data.renote)) ? renderAnnounce(data.renote.uri ? data.renote.uri : await renderNote(data.renote))