タイムラインでリプライ先の投稿を表示するか否か設定できるように

This commit is contained in:
syuilo 2018-04-18 07:35:56 +09:00
parent 957cddf4db
commit fa8a08f016
4 changed files with 18 additions and 8 deletions

View file

@ -16,6 +16,14 @@ import Err from '../common/views/components/connect-failed.vue';
import { LocalTimelineStreamManager } from './scripts/streaming/local-timeline'; import { LocalTimelineStreamManager } from './scripts/streaming/local-timeline';
import { GlobalTimelineStreamManager } from './scripts/streaming/global-timeline'; import { GlobalTimelineStreamManager } from './scripts/streaming/global-timeline';
const defaultSettings = {
fetchOnScroll: true,
showMaps: true,
showPostFormOnTopOfTl: false,
gradientWindowHeader: false,
showReplyTarget: true
};
//#region api requests //#region api requests
let spinner = null; let spinner = null;
let pending = 0; let pending = 0;
@ -298,12 +306,7 @@ export default class MiOS extends EventEmitter {
const fetched = me => { const fetched = me => {
if (me) { if (me) {
// デフォルトの設定をマージ // デフォルトの設定をマージ
me.clientSettings = Object.assign({ me.clientSettings = Object.assign(defaultSettings, me.clientSettings);
fetchOnScroll: true,
showMaps: true,
showPostFormOnTopOfTl: false,
gradientWindowHeader: false
}, me.clientSettings);
// ローカルストレージにキャッシュ // ローカルストレージにキャッシュ
localStorage.setItem('me', JSON.stringify(me)); localStorage.setItem('me', JSON.stringify(me));

View file

@ -1,6 +1,6 @@
<template> <template>
<div class="note" tabindex="-1" :title="title" @keydown="onKeydown"> <div class="note" tabindex="-1" :title="title" @keydown="onKeydown">
<div class="reply-to" v-if="p.reply"> <div class="reply-to" v-if="p.reply && (!os.isSignedIn || os.i.clientSettings.showReplyTarget)">
<x-sub :note="p.reply"/> <x-sub :note="p.reply"/>
</div> </div>
<div class="renote" v-if="isRenote"> <div class="renote" v-if="isRenote">

View file

@ -40,6 +40,7 @@
<button class="ui button" @click="customizeHome">ホームをカスタマイズ</button> <button class="ui button" @click="customizeHome">ホームをカスタマイズ</button>
</div> </div>
<mk-switch v-model="os.i.clientSettings.showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl" text="タイムライン上部に投稿フォームを表示する"/> <mk-switch v-model="os.i.clientSettings.showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl" text="タイムライン上部に投稿フォームを表示する"/>
<mk-switch v-model="os.i.clientSettings.showReplyTarget" @change="onChangeShowReplyTarget" text="リプライ先を表示する"/>
<mk-switch v-model="os.i.clientSettings.showMaps" @change="onChangeShowMaps" text="マップの自動展開"> <mk-switch v-model="os.i.clientSettings.showMaps" @change="onChangeShowMaps" text="マップの自動展開">
<span>位置情報が添付された投稿のマップを自動的に展開します</span> <span>位置情報が添付された投稿のマップを自動的に展開します</span>
</mk-switch> </mk-switch>
@ -303,6 +304,12 @@ export default Vue.extend({
value: v value: v
}); });
}, },
onChangeShowReplyTarget(v) {
(this as any).api('i/update_client_setting', {
name: 'showReplyTarget',
value: v
});
},
onChangeShowMaps(v) { onChangeShowMaps(v) {
(this as any).api('i/update_client_setting', { (this as any).api('i/update_client_setting', {
name: 'showMaps', name: 'showMaps',

View file

@ -1,6 +1,6 @@
<template> <template>
<div class="note" :class="{ renote: isRenote }"> <div class="note" :class="{ renote: isRenote }">
<div class="reply-to" v-if="p.reply"> <div class="reply-to" v-if="p.reply && (!os.isSignedIn || os.i.clientSettings.showReplyTarget)">
<x-sub :note="p.reply"/> <x-sub :note="p.reply"/>
</div> </div>
<div class="renote" v-if="isRenote"> <div class="renote" v-if="isRenote">