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>
<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>

View file

@ -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,

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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 =>
_note.media = hide ? [] : Promise.all(_note.mediaIds.map(fileId =>
packFile(fileId)
));
}
// When requested a detailed note data
if (opts.detail) {

View file

@ -123,16 +123,32 @@ export default async (user: IUser, data: {
if (note.channelId == null) {
if (!silent) {
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
stream(note.userId, 'note', noteObj);
// Publish note to local timeline stream
publishLocalTimelineStream(noteObj);
}
}
// Publish note to global timeline stream
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({
followeeId: note.userId
@ -159,6 +175,7 @@ export default async (user: IUser, data: {
}
});
});
}
// リストに配信
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))