バグ修正など

This commit is contained in:
syuilo 2018-04-29 17:54:50 +09:00
parent 665afccb45
commit a8083eb52b
6 changed files with 21 additions and 28 deletions

View File

@ -332,7 +332,7 @@ export default class MiOS extends EventEmitter {
const cachedSettings = JSON.parse(localStorage.getItem('settings'));
if (cachedSettings) {
this.store.commit('settings/init', cachedSettings);
this.store.dispatch('settings/merge', cachedSettings);
}
//#endregion
@ -350,7 +350,7 @@ export default class MiOS extends EventEmitter {
fetchme(cachedMe.token, freshData => {
merge(cachedMe, freshData);
this.store.commit('settings/init', freshData.clientSettings);
this.store.dispatch('settings/merge', freshData.clientSettings);
});
} else {
// Get token from cookie
@ -358,9 +358,7 @@ export default class MiOS extends EventEmitter {
fetchme(i, me => {
if (me) {
Object.entries(me.clientSettings).forEach(([key, value]) => {
this.store.commit('settings/set', { key, value });
});
this.store.dispatch('settings/merge', me.clientSettings);
fetched(me);
} else {

View File

@ -41,7 +41,7 @@
</div>
<div class="div">
<mk-switch v-model="darkmode" text="ダークモード"/>
<mk-switch v-model="clientSettings.circleIcons" @change="onChangeCircleIcons" text="丸いアイコンを使用"/>
<mk-switch v-model="clientSettings.circleIcons" @change="onChangeCircleIcons" text="円形のアイコンを使用"/>
<mk-switch v-model="clientSettings.gradientWindowHeader" @change="onChangeGradientWindowHeader" text="ウィンドウのタイトルバーにグラデーションを使用"/>
</div>
<mk-switch v-model="clientSettings.showPostFormOnTopOfTl" @change="onChangeShowPostFormOnTopOfTl" text="タイムライン上部に投稿フォームを表示する"/>

View File

@ -8,7 +8,7 @@
<p>ようこそ <b>Misskey</b>はTwitter風ミニブログSNSです思ったことや皆と共有したいことを投稿しましょうタイムラインを見れば皆の関心事をすぐにチェックすることもできます<a :href="aboutUrl">詳しく...</a></p>
<p><button class="signup" @click="signup">はじめる</button><button class="signin" @click="signin">ログイン</button></p>
<div class="users">
<mk-avatar class="avatar" :key="user.id" :user="user"/>
<mk-avatar class="avatar" v-for="user in users" :key="user.id" :user="user"/>
</div>
</div>
<div>
@ -215,13 +215,9 @@ export default Vue.extend({
> *
display inline-block
margin 4px
> *
display inline-block
width 38px
height 38px
vertical-align top
border-radius 6px
width 38px
height 38px
border-radius 6px
> div:last-child

View File

@ -22,7 +22,7 @@
<mk-welcome-timeline/>
</div>
<div class="users">
<mk-avatar class="avatar" :key="user.id" :user="user"/>
<mk-avatar class="avatar" v-for="user in users" :key="user.id" :user="user"/>
</div>
<footer>
<small>{{ copyright }}</small>
@ -183,13 +183,9 @@ export default Vue.extend({
> *
display inline-block
margin 4px
> *
display inline-block
width 38px
height 38px
vertical-align top
border-radius 6px
width 38px
height 38px
border-radius 6px
> footer
text-align center

View File

@ -41,10 +41,6 @@ export default (os: MiOS) => new Vuex.Store({
},
mutations: {
init(state, settings) {
state.data = settings;
},
set(state, x: { key: string; value: any }) {
state.data[x.key] = x.value;
},
@ -66,6 +62,12 @@ export default (os: MiOS) => new Vuex.Store({
},
actions: {
merge(ctx, settings) {
Object.entries(settings).forEach(([key, value]) => {
ctx.commit('set', { key, value });
});
},
set(ctx, x) {
ctx.commit('set', x);

View File

@ -70,12 +70,13 @@ export default async function(
}
});
connection.on('message', data => {
connection.on('message', async data => {
const msg = JSON.parse(data.utf8Data);
switch (msg.type) {
case 'api':
call(msg.endpoint, user, app, msg.data).then(res => {
// 新鮮なデータを利用するためにユーザーをフェッチ
call(msg.endpoint, await User.findOne({ _id: user._id }), app, msg.data).then(res => {
connection.send(JSON.stringify({
type: `api-res:${msg.id}`,
body: { res }