Privateの公開範囲を廃止

This commit is contained in:
syuilo 2018-12-29 02:55:46 +09:00
parent 545ced7826
commit a3493c4f07
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
10 changed files with 18 additions and 30 deletions

View File

@ -18,8 +18,7 @@
<span class="visibility" v-if="note.visibility != 'public'">
<fa v-if="note.visibility == 'home'" icon="home"/>
<fa v-if="note.visibility == 'followers'" icon="unlock"/>
<fa v-if="note.visibility == 'specified'" icon="envelope"/>
<fa v-if="note.visibility == 'private'" icon="lock"/>
<fa v-if="note.visibility == 'specified'" icon="lock"/>
</span>
<span class="localOnly" v-if="note.localOnly == true"><fa icon="heart"/></span>
</div>

View File

@ -13,8 +13,7 @@
<span class="visibility" v-if="note.visibility != 'public'">
<fa v-if="note.visibility == 'home'" icon="home"/>
<fa v-if="note.visibility == 'followers'" icon="unlock"/>
<fa v-if="note.visibility == 'specified'" icon="envelope"/>
<fa v-if="note.visibility == 'private'" icon="lock"/>
<fa v-if="note.visibility == 'specified'" icon="lock"/>
</span>
<span class="localOnly" v-if="note.localOnly == true"><fa icon="heart"/></span>
</div>

View File

@ -23,18 +23,12 @@
</div>
</div>
<div @click="choose('specified')" :class="{ active: v == 'specified' }">
<div><fa icon="envelope"/></div>
<div><fa icon="lock"/></div>
<div>
<span>{{ $t('specified') }}</span>
<span>{{ $t('specified-desc') }}</span>
</div>
</div>
<div @click="choose('private')" :class="{ active: v == 'private' }">
<div><fa icon="lock"/></div>
<div>
<span>{{ $t('private') }}</span>
</div>
</div>
<div @click="choose('local-public')" :class="{ active: v == 'local-public' }">
<div><fa icon="globe"/></div>
<div>

View File

@ -50,8 +50,7 @@
<span v-if="visibility === 'public'"><fa icon="globe"/></span>
<span v-if="visibility === 'home'"><fa icon="home"/></span>
<span v-if="visibility === 'followers'"><fa icon="unlock"/></span>
<span v-if="visibility === 'specified'"><fa icon="envelope"/></span>
<span v-if="visibility === 'private'"><fa icon="lock"/></span>
<span v-if="visibility === 'specified'"><fa icon="lock"/></span>
</button>
<p class="text-count" :class="{ over: trimmedLength(text) > maxNoteTextLength }">{{ maxNoteTextLength - trimmedLength(text) }}</p>
<ui-button primary :wait="posting" class="submit" :disabled="!canPost" @click="post">
@ -212,7 +211,7 @@ export default Vue.extend({
this.applyVisibility(this.$store.state.settings.rememberNoteVisibility ? (this.$store.state.device.visibility || this.$store.state.settings.defaultNoteVisibility) : this.$store.state.settings.defaultNoteVisibility);
//
if (this.reply && ['home', 'followers', 'specified', 'private'].includes(this.reply.visibility)) {
if (this.reply && ['home', 'followers', 'specified'].includes(this.reply.visibility)) {
this.visibility = this.reply.visibility;
}

View File

@ -54,8 +54,7 @@
<span class="visibility" v-if="appearNote.visibility != 'public'">
<fa v-if="appearNote.visibility == 'home'" icon="home"/>
<fa v-if="appearNote.visibility == 'followers'" icon="unlock"/>
<fa v-if="appearNote.visibility == 'specified'" icon="envelope"/>
<fa v-if="appearNote.visibility == 'private'" icon="lock"/>
<fa v-if="appearNote.visibility == 'specified'" icon="lock"/>
</span>
<span class="localOnly" v-if="appearNote.localOnly == true"><fa icon="heart"/></span>
</div>

View File

@ -41,8 +41,7 @@
<span v-if="visibility === 'public'"><fa icon="globe"/></span>
<span v-if="visibility === 'home'"><fa icon="home"/></span>
<span v-if="visibility === 'followers'"><fa icon="unlock"/></span>
<span v-if="visibility === 'specified'"><fa icon="envelope"/></span>
<span v-if="visibility === 'private'"><fa icon="lock"/></span>
<span v-if="visibility === 'specified'"><fa icon="lock"/></span>
</button>
</footer>
<input ref="file" class="file" type="file" multiple="multiple" @change="onChangeFile"/>
@ -202,7 +201,7 @@ export default Vue.extend({
this.applyVisibility(this.$store.state.settings.rememberNoteVisibility ? (this.$store.state.device.visibility || this.$store.state.settings.defaultNoteVisibility) : this.$store.state.settings.defaultNoteVisibility);
//
if (this.reply && ['home', 'followers', 'specified', 'private'].includes(this.reply.visibility)) {
if (this.reply && ['home', 'followers', 'specified'].includes(this.reply.visibility)) {
this.visibility = this.reply.visibility;
}

View File

@ -67,9 +67,8 @@ export type INote = {
* home ... ()
* followers ...
* specified ... visibleUserIds
* private ...
*/
visibility: 'public' | 'home' | 'followers' | 'specified' | 'private';
visibility: 'public' | 'home' | 'followers' | 'specified';
visibleUserIds: mongo.ObjectID[];
@ -106,7 +105,7 @@ export type INote = {
export const hideNote = async (packedNote: any, meId: mongo.ObjectID) => {
let hide = false;
// visibility が private かつ投稿者のIDが自分のIDではなかったら非表示
// visibility が private かつ投稿者のIDが自分のIDではなかったら非表示(後方互換性のため)
if (packedNote.visibility == 'private' && (meId == null || !meId.equals(packedNote.userId))) {
hide = true;
}

View File

@ -52,7 +52,7 @@ export default async function(resolver: Resolver, actor: IRemoteUser, activity:
});
}
type visibility = 'public' | 'home' | 'followers' | 'specified' | 'private';
type visibility = 'public' | 'home' | 'followers' | 'specified';
function getVisibility(to: string[], cc: string[], actor: IRemoteUser): visibility {
const PUBLIC = 'https://www.w3.org/ns/activitystreams#Public';

View File

@ -247,6 +247,11 @@ export default define(meta, (ps, user, app) => new Promise(async (res, rej) => {
return rej('text, fileIds, renoteId or poll is required');
}
// 後方互換性のため
if (ps.visibility == 'private') {
ps.visibility = 'specified';
}
// 投稿を作成
create(user, {
createdAt: new Date(),

View File

@ -133,11 +133,6 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
return rej('Renote target is not public or home');
}
// リプライ対象が自分以外の非公開の投稿なら禁止
if (data.reply && data.reply.visibility == 'private' && !data.reply.userId.equals(user._id)) {
return rej('Reply target is private of others');
}
// ローカルのみをRenoteしたらローカルのみにする
if (data.renote && data.renote.localOnly) {
data.localOnly = true;
@ -282,7 +277,7 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
const noteActivity = await renderActivity(data, note);
if (isLocalUser(user) && note.visibility != 'private') {
if (isLocalUser(user)) {
deliverNoteToMentionedRemoteUsers(mentionedUsers, user, noteActivity);
}
@ -369,7 +364,7 @@ async function publish(user: IUser, note: INote, noteObj: any, reply: INote, ren
deliver(user, noteActivity, renote._user.inbox);
}
if (['private', 'followers', 'specified'].includes(note.visibility)) {
if (['followers', 'specified'].includes(note.visibility)) {
const detailPackedNote = await pack(note, user, {
detail: true
});