mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-04 22:25:50 +02:00
Refactor
This commit is contained in:
@@ -38,7 +38,7 @@ export default Vue.extend({
|
||||
|
||||
computed: {
|
||||
alone(): boolean {
|
||||
return (this as any).os.i.followingCount == 0;
|
||||
return this.$store.state.i.followingCount == 0;
|
||||
},
|
||||
|
||||
stream(): any {
|
||||
@@ -92,8 +92,8 @@ export default Vue.extend({
|
||||
(this as any).api(this.endpoint, {
|
||||
limit: fetchLimit + 1,
|
||||
untilDate: this.date ? this.date.getTime() : undefined,
|
||||
includeMyRenotes: (this as any).clientSettings.showMyRenotes,
|
||||
includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes
|
||||
includeMyRenotes: this.$store.state.settings.showMyRenotes,
|
||||
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes
|
||||
}).then(notes => {
|
||||
if (notes.length == fetchLimit + 1) {
|
||||
notes.pop();
|
||||
@@ -114,8 +114,8 @@ export default Vue.extend({
|
||||
const promise = (this as any).api(this.endpoint, {
|
||||
limit: fetchLimit + 1,
|
||||
untilId: (this.$refs.timeline as any).tail().id,
|
||||
includeMyRenotes: (this as any).clientSettings.showMyRenotes,
|
||||
includeRenotedMyNotes: (this as any).clientSettings.showRenotedMyNotes
|
||||
includeMyRenotes: this.$store.state.settings.showMyRenotes,
|
||||
includeRenotedMyNotes: this.$store.state.settings.showRenotedMyNotes
|
||||
});
|
||||
|
||||
promise.then(notes => {
|
||||
|
||||
@@ -87,7 +87,7 @@ export default Vue.extend({
|
||||
if (this.src == 'list') {
|
||||
this.list = this.$store.state.device.tl.arg;
|
||||
}
|
||||
} else if ((this as any).os.i.followingCount == 0) {
|
||||
} else if (this.$store.state.i.followingCount == 0) {
|
||||
this.src = 'local';
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<component :is="os.isSignedIn ? 'home' : 'welcome'"></component>
|
||||
<component :is="$store.getters.isSignedIn ? 'home' : 'welcome'"></component>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
|
||||
@@ -17,22 +17,22 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<md-switch v-model="clientSettings.circleIcons" @change="onChangeCircleIcons">%i18n:@circle-icons%</md-switch>
|
||||
<md-switch v-model="$store.state.settings.circleIcons" @change="onChangeCircleIcons">%i18n:@circle-icons%</md-switch>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="md-body-2">%i18n:@timeline%</div>
|
||||
|
||||
<div>
|
||||
<md-switch v-model="clientSettings.showReplyTarget" @change="onChangeShowReplyTarget">%i18n:@show-reply-target%</md-switch>
|
||||
<md-switch v-model="$store.state.settings.showReplyTarget" @change="onChangeShowReplyTarget">%i18n:@show-reply-target%</md-switch>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<md-switch v-model="clientSettings.showMyRenotes" @change="onChangeShowMyRenotes">%i18n:@show-my-renotes%</md-switch>
|
||||
<md-switch v-model="$store.state.settings.showMyRenotes" @change="onChangeShowMyRenotes">%i18n:@show-my-renotes%</md-switch>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<md-switch v-model="clientSettings.showRenotedMyNotes" @change="onChangeShowRenotedMyNotes">%i18n:@show-renoted-my-notes%</md-switch>
|
||||
<md-switch v-model="$store.state.settings.showRenotedMyNotes" @change="onChangeShowRenotedMyNotes">%i18n:@show-renoted-my-notes%</md-switch>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -52,11 +52,11 @@
|
||||
|
||||
<md-card-content>
|
||||
<div>
|
||||
<md-switch v-model="clientSettings.fetchOnScroll" @change="onChangeFetchOnScroll">%i18n:@fetch-on-scroll%</md-switch>
|
||||
<md-switch v-model="$store.state.settings.fetchOnScroll" @change="onChangeFetchOnScroll">%i18n:@fetch-on-scroll%</md-switch>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<md-switch v-model="clientSettings.disableViaMobile" @change="onChangeDisableViaMobile">%i18n:@disable-via-mobile%</md-switch>
|
||||
<md-switch v-model="$store.state.settings.disableViaMobile" @change="onChangeDisableViaMobile">%i18n:@disable-via-mobile%</md-switch>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -64,7 +64,7 @@
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<md-switch v-model="clientSettings.loadRemoteMedia" @change="onChangeLoadRemoteMedia">%i18n:@load-remote-media%</md-switch>
|
||||
<md-switch v-model="$store.state.settings.loadRemoteMedia" @change="onChangeLoadRemoteMedia">%i18n:@load-remote-media%</md-switch>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
@@ -100,11 +100,11 @@
|
||||
</md-card-header>
|
||||
|
||||
<md-card-content>
|
||||
<p class="account" v-if="os.i.twitter"><a :href="`https://twitter.com/${os.i.twitter.screenName}`" target="_blank">@{{ os.i.twitter.screenName }}</a></p>
|
||||
<p class="account" v-if="$store.state.i.twitter"><a :href="`https://twitter.com/${$store.state.i.twitter.screenName}`" target="_blank">@{{ $store.state.i.twitter.screenName }}</a></p>
|
||||
<p>
|
||||
<a :href="`${apiUrl}/connect/twitter`" target="_blank">{{ os.i.twitter ? '%i18n:@twitter-reconnect%' : '%i18n:@twitter-connect%' }}</a>
|
||||
<span v-if="os.i.twitter"> or </span>
|
||||
<a :href="`${apiUrl}/disconnect/twitter`" target="_blank" v-if="os.i.twitter">%i18n:@twitter-disconnect%</a>
|
||||
<a :href="`${apiUrl}/connect/twitter`" target="_blank">{{ $store.state.i.twitter ? '%i18n:@twitter-reconnect%' : '%i18n:@twitter-connect%' }}</a>
|
||||
<span v-if="$store.state.i.twitter"> or </span>
|
||||
<a :href="`${apiUrl}/disconnect/twitter`" target="_blank" v-if="$store.state.i.twitter">%i18n:@twitter-disconnect%</a>
|
||||
</p>
|
||||
</md-card-content>
|
||||
</md-card>
|
||||
@@ -156,7 +156,7 @@ export default Vue.extend({
|
||||
|
||||
computed: {
|
||||
name(): string {
|
||||
return Vue.filter('userName')((this as any).os.i);
|
||||
return Vue.filter('userName')(this.$store.state.i);
|
||||
},
|
||||
|
||||
darkmode: {
|
||||
|
||||
@@ -82,15 +82,15 @@ export default Vue.extend({
|
||||
},
|
||||
|
||||
created() {
|
||||
this.name = (this as any).os.i.name || '';
|
||||
this.username = (this as any).os.i.username;
|
||||
this.location = (this as any).os.i.profile.location;
|
||||
this.description = (this as any).os.i.description;
|
||||
this.birthday = (this as any).os.i.profile.birthday;
|
||||
this.avatarId = (this as any).os.i.avatarId;
|
||||
this.bannerId = (this as any).os.i.bannerId;
|
||||
this.isBot = (this as any).os.i.isBot;
|
||||
this.isCat = (this as any).os.i.isCat;
|
||||
this.name = this.$store.state.i.name || '';
|
||||
this.username = this.$store.state.i.username;
|
||||
this.location = this.$store.state.i.profile.location;
|
||||
this.description = this.$store.state.i.description;
|
||||
this.birthday = this.$store.state.i.profile.birthday;
|
||||
this.avatarId = this.$store.state.i.avatarId;
|
||||
this.bannerId = this.$store.state.i.bannerId;
|
||||
this.isBot = this.$store.state.i.isBot;
|
||||
this.isCat = this.$store.state.i.isCat;
|
||||
},
|
||||
|
||||
methods: {
|
||||
@@ -99,7 +99,7 @@ export default Vue.extend({
|
||||
|
||||
const data = new FormData();
|
||||
data.append('file', file);
|
||||
data.append('i', (this as any).os.i.token);
|
||||
data.append('i', this.$store.state.i.token);
|
||||
|
||||
fetch(apiUrl + '/drive/files/create', {
|
||||
method: 'POST',
|
||||
@@ -121,7 +121,7 @@ export default Vue.extend({
|
||||
|
||||
const data = new FormData();
|
||||
data.append('file', file);
|
||||
data.append('i', (this as any).os.i.token);
|
||||
data.append('i', this.$store.state.i.token);
|
||||
|
||||
fetch(apiUrl + '/drive/files/create', {
|
||||
method: 'POST',
|
||||
@@ -152,10 +152,10 @@ export default Vue.extend({
|
||||
isCat: this.isCat
|
||||
}).then(i => {
|
||||
this.saving = false;
|
||||
(this as any).os.i.avatarId = i.avatarId;
|
||||
(this as any).os.i.avatarUrl = i.avatarUrl;
|
||||
(this as any).os.i.bannerId = i.bannerId;
|
||||
(this as any).os.i.bannerUrl = i.bannerUrl;
|
||||
this.$store.state.i.avatarId = i.avatarId;
|
||||
this.$store.state.i.avatarUrl = i.avatarUrl;
|
||||
this.$store.state.i.bannerId = i.bannerId;
|
||||
this.$store.state.i.bannerUrl = i.bannerUrl;
|
||||
|
||||
alert('%i18n:@saved%');
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<a class="avatar">
|
||||
<img :src="user.avatarUrl" alt="avatar"/>
|
||||
</a>
|
||||
<mk-follow-button v-if="os.isSignedIn && os.i.id != user.id" :user="user"/>
|
||||
<mk-follow-button v-if="$store.getters.isSignedIn && $store.state.i.id != user.id" :user="user"/>
|
||||
</div>
|
||||
<div class="title">
|
||||
<h1>{{ user | userName }}</h1>
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<x-friends :user="user"/>
|
||||
</div>
|
||||
</section>
|
||||
<section class="followers-you-know" v-if="os.isSignedIn && os.i.id !== user.id">
|
||||
<section class="followers-you-know" v-if="$store.getters.isSignedIn && $store.state.i.id !== user.id">
|
||||
<h2>%fa:users%%i18n:@followers-you-know%</h2>
|
||||
<div>
|
||||
<x-followers-you-know :user="user"/>
|
||||
|
||||
Reference in New Issue
Block a user