Skip to content
Snippets Groups Projects
Unverified Commit a3493c4f authored by syuilo's avatar syuilo
Browse files

Privateの公開範囲を廃止

parent 545ced78
No related branches found
No related tags found
No related merge requests found
......@@ -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>
......
......@@ -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>
......
......@@ -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>
......
......@@ -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;
}
......
......@@ -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>
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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';
......
......@@ -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(),
......
......@@ -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
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment