forked from FoundKeyGang/FoundKey
Privateの公開範囲を廃止
This commit is contained in:
parent
545ced7826
commit
a3493c4f07
10 changed files with 18 additions and 30 deletions
|
@ -18,8 +18,7 @@
|
||||||
<span class="visibility" v-if="note.visibility != 'public'">
|
<span class="visibility" v-if="note.visibility != 'public'">
|
||||||
<fa v-if="note.visibility == 'home'" icon="home"/>
|
<fa v-if="note.visibility == 'home'" icon="home"/>
|
||||||
<fa v-if="note.visibility == 'followers'" icon="unlock"/>
|
<fa v-if="note.visibility == 'followers'" icon="unlock"/>
|
||||||
<fa v-if="note.visibility == 'specified'" icon="envelope"/>
|
<fa v-if="note.visibility == 'specified'" icon="lock"/>
|
||||||
<fa v-if="note.visibility == 'private'" icon="lock"/>
|
|
||||||
</span>
|
</span>
|
||||||
<span class="localOnly" v-if="note.localOnly == true"><fa icon="heart"/></span>
|
<span class="localOnly" v-if="note.localOnly == true"><fa icon="heart"/></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -13,8 +13,7 @@
|
||||||
<span class="visibility" v-if="note.visibility != 'public'">
|
<span class="visibility" v-if="note.visibility != 'public'">
|
||||||
<fa v-if="note.visibility == 'home'" icon="home"/>
|
<fa v-if="note.visibility == 'home'" icon="home"/>
|
||||||
<fa v-if="note.visibility == 'followers'" icon="unlock"/>
|
<fa v-if="note.visibility == 'followers'" icon="unlock"/>
|
||||||
<fa v-if="note.visibility == 'specified'" icon="envelope"/>
|
<fa v-if="note.visibility == 'specified'" icon="lock"/>
|
||||||
<fa v-if="note.visibility == 'private'" icon="lock"/>
|
|
||||||
</span>
|
</span>
|
||||||
<span class="localOnly" v-if="note.localOnly == true"><fa icon="heart"/></span>
|
<span class="localOnly" v-if="note.localOnly == true"><fa icon="heart"/></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -23,18 +23,12 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div @click="choose('specified')" :class="{ active: v == 'specified' }">
|
<div @click="choose('specified')" :class="{ active: v == 'specified' }">
|
||||||
<div><fa icon="envelope"/></div>
|
<div><fa icon="lock"/></div>
|
||||||
<div>
|
<div>
|
||||||
<span>{{ $t('specified') }}</span>
|
<span>{{ $t('specified') }}</span>
|
||||||
<span>{{ $t('specified-desc') }}</span>
|
<span>{{ $t('specified-desc') }}</span>
|
||||||
</div>
|
</div>
|
||||||
</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 @click="choose('local-public')" :class="{ active: v == 'local-public' }">
|
||||||
<div><fa icon="globe"/></div>
|
<div><fa icon="globe"/></div>
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -50,8 +50,7 @@
|
||||||
<span v-if="visibility === 'public'"><fa icon="globe"/></span>
|
<span v-if="visibility === 'public'"><fa icon="globe"/></span>
|
||||||
<span v-if="visibility === 'home'"><fa icon="home"/></span>
|
<span v-if="visibility === 'home'"><fa icon="home"/></span>
|
||||||
<span v-if="visibility === 'followers'"><fa icon="unlock"/></span>
|
<span v-if="visibility === 'followers'"><fa icon="unlock"/></span>
|
||||||
<span v-if="visibility === 'specified'"><fa icon="envelope"/></span>
|
<span v-if="visibility === 'specified'"><fa icon="lock"/></span>
|
||||||
<span v-if="visibility === 'private'"><fa icon="lock"/></span>
|
|
||||||
</button>
|
</button>
|
||||||
<p class="text-count" :class="{ over: trimmedLength(text) > maxNoteTextLength }">{{ maxNoteTextLength - trimmedLength(text) }}</p>
|
<p class="text-count" :class="{ over: trimmedLength(text) > maxNoteTextLength }">{{ maxNoteTextLength - trimmedLength(text) }}</p>
|
||||||
<ui-button primary :wait="posting" class="submit" :disabled="!canPost" @click="post">
|
<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);
|
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;
|
this.visibility = this.reply.visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,7 @@
|
||||||
<span class="visibility" v-if="appearNote.visibility != 'public'">
|
<span class="visibility" v-if="appearNote.visibility != 'public'">
|
||||||
<fa v-if="appearNote.visibility == 'home'" icon="home"/>
|
<fa v-if="appearNote.visibility == 'home'" icon="home"/>
|
||||||
<fa v-if="appearNote.visibility == 'followers'" icon="unlock"/>
|
<fa v-if="appearNote.visibility == 'followers'" icon="unlock"/>
|
||||||
<fa v-if="appearNote.visibility == 'specified'" icon="envelope"/>
|
<fa v-if="appearNote.visibility == 'specified'" icon="lock"/>
|
||||||
<fa v-if="appearNote.visibility == 'private'" icon="lock"/>
|
|
||||||
</span>
|
</span>
|
||||||
<span class="localOnly" v-if="appearNote.localOnly == true"><fa icon="heart"/></span>
|
<span class="localOnly" v-if="appearNote.localOnly == true"><fa icon="heart"/></span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -41,8 +41,7 @@
|
||||||
<span v-if="visibility === 'public'"><fa icon="globe"/></span>
|
<span v-if="visibility === 'public'"><fa icon="globe"/></span>
|
||||||
<span v-if="visibility === 'home'"><fa icon="home"/></span>
|
<span v-if="visibility === 'home'"><fa icon="home"/></span>
|
||||||
<span v-if="visibility === 'followers'"><fa icon="unlock"/></span>
|
<span v-if="visibility === 'followers'"><fa icon="unlock"/></span>
|
||||||
<span v-if="visibility === 'specified'"><fa icon="envelope"/></span>
|
<span v-if="visibility === 'specified'"><fa icon="lock"/></span>
|
||||||
<span v-if="visibility === 'private'"><fa icon="lock"/></span>
|
|
||||||
</button>
|
</button>
|
||||||
</footer>
|
</footer>
|
||||||
<input ref="file" class="file" type="file" multiple="multiple" @change="onChangeFile"/>
|
<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);
|
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;
|
this.visibility = this.reply.visibility;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,9 +67,8 @@ export type INote = {
|
||||||
* home ... ホームタイムライン(ユーザーページのタイムライン含む)のみに流す
|
* home ... ホームタイムライン(ユーザーページのタイムライン含む)のみに流す
|
||||||
* followers ... フォロワーのみ
|
* followers ... フォロワーのみ
|
||||||
* specified ... visibleUserIds で指定したユーザーのみ
|
* specified ... visibleUserIds で指定したユーザーのみ
|
||||||
* private ... 自分のみ
|
|
||||||
*/
|
*/
|
||||||
visibility: 'public' | 'home' | 'followers' | 'specified' | 'private';
|
visibility: 'public' | 'home' | 'followers' | 'specified';
|
||||||
|
|
||||||
visibleUserIds: mongo.ObjectID[];
|
visibleUserIds: mongo.ObjectID[];
|
||||||
|
|
||||||
|
@ -106,7 +105,7 @@ export type INote = {
|
||||||
export const hideNote = async (packedNote: any, meId: mongo.ObjectID) => {
|
export const hideNote = async (packedNote: any, meId: mongo.ObjectID) => {
|
||||||
let hide = false;
|
let hide = false;
|
||||||
|
|
||||||
// visibility が private かつ投稿者のIDが自分のIDではなかったら非表示
|
// visibility が private かつ投稿者のIDが自分のIDではなかったら非表示(後方互換性のため)
|
||||||
if (packedNote.visibility == 'private' && (meId == null || !meId.equals(packedNote.userId))) {
|
if (packedNote.visibility == 'private' && (meId == null || !meId.equals(packedNote.userId))) {
|
||||||
hide = true;
|
hide = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
function getVisibility(to: string[], cc: string[], actor: IRemoteUser): visibility {
|
||||||
const PUBLIC = 'https://www.w3.org/ns/activitystreams#Public';
|
const PUBLIC = 'https://www.w3.org/ns/activitystreams#Public';
|
||||||
|
|
|
@ -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');
|
return rej('text, fileIds, renoteId or poll is required');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 後方互換性のため
|
||||||
|
if (ps.visibility == 'private') {
|
||||||
|
ps.visibility = 'specified';
|
||||||
|
}
|
||||||
|
|
||||||
// 投稿を作成
|
// 投稿を作成
|
||||||
create(user, {
|
create(user, {
|
||||||
createdAt: new Date(),
|
createdAt: new Date(),
|
||||||
|
|
|
@ -133,11 +133,6 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
|
||||||
return rej('Renote target is not public or home');
|
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したらローカルのみにする
|
// ローカルのみをRenoteしたらローカルのみにする
|
||||||
if (data.renote && data.renote.localOnly) {
|
if (data.renote && data.renote.localOnly) {
|
||||||
data.localOnly = true;
|
data.localOnly = true;
|
||||||
|
@ -282,7 +277,7 @@ export default async (user: IUser, data: Option, silent = false) => new Promise<
|
||||||
|
|
||||||
const noteActivity = await renderActivity(data, note);
|
const noteActivity = await renderActivity(data, note);
|
||||||
|
|
||||||
if (isLocalUser(user) && note.visibility != 'private') {
|
if (isLocalUser(user)) {
|
||||||
deliverNoteToMentionedRemoteUsers(mentionedUsers, user, noteActivity);
|
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);
|
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, {
|
const detailPackedNote = await pack(note, user, {
|
||||||
detail: true
|
detail: true
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue