This commit is contained in:
syuilo 2018-04-29 05:28:34 +09:00
parent a16792533a
commit d032127ce5
2 changed files with 35 additions and 1 deletions

View File

@ -6,6 +6,10 @@
@drop.stop="onDrop" @drop.stop="onDrop"
> >
<div class="content"> <div class="content">
<div v-if="visibility == 'specified'" class="visibleUsers">
<span v-for="u in visibleUsers">{{ u | userName }}<a @click="removeVisibleUser(u)">[x]</a></span>
<a @click="addVisibleUser">+ユーザーを追加</a>
</div>
<input v-show="useCw" v-model="cw" placeholder="内容への注釈 (オプション)"> <input v-show="useCw" v-model="cw" placeholder="内容への注釈 (オプション)">
<textarea :class="{ with: (files.length != 0 || poll) }" <textarea :class="{ with: (files.length != 0 || poll) }"
ref="text" v-model="text" :disabled="posting" ref="text" v-model="text" :disabled="posting"
@ -64,6 +68,7 @@ export default Vue.extend({
cw: null, cw: null,
geo: null, geo: null,
visibility: 'public', visibility: 'public',
visibleUsers: [],
autocomplete: null, autocomplete: null,
draghover: false draghover: false
}; };
@ -259,6 +264,22 @@ export default Vue.extend({
}); });
}, },
addVisibleUser() {
(this as any).apis.input({
title: 'ユーザー名を入力してください'
}).then(username => {
(this as any).api('users/show', {
username
}).then(user => {
this.visibleUsers.push(user);
});
});
},
removeVisibleUser(user) {
this.visibleUsers = this.visibleUsers.filter(u => u != user);
},
post() { post() {
this.posting = true; this.posting = true;
@ -270,6 +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),
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,
@ -395,6 +417,14 @@ root(isDark)
border-bottom solid 1px rgba($theme-color, 0.1) !important border-bottom solid 1px rgba($theme-color, 0.1) !important
border-radius 4px 4px 0 0 border-radius 4px 4px 0 0
> .visibleUsers
margin-bottom 8px
font-size 14px
> span
margin-right 16px
color isDark ? #fff : #666
> .medias > .medias
margin 0 margin 0
padding 0 padding 0

View File

@ -76,7 +76,11 @@ export default async (user: IUser, data: {
geo: data.geo || null, geo: data.geo || null,
appId: data.app ? data.app._id : null, appId: data.app ? data.app._id : null,
visibility: data.visibility, visibility: data.visibility,
visibleUserIds: data.visibleUsers ? data.visibleUsers.map(u => u._id) : [], visibleUserIds: data.visibility == 'specified'
? data.visibleUsers
? data.visibleUsers.map(u => u._id)
: []
: [],
// 以下非正規化データ // 以下非正規化データ
_reply: data.reply ? { userId: data.reply.userId } : null, _reply: data.reply ? { userId: data.reply.userId } : null,