Introduce account document to user document
An account document is attached to a user document if an account of the user is on the server. It may be missing if the user is on a remote server.
This commit is contained in:
parent
a633f184ab
commit
19b9cb105d
70 changed files with 355 additions and 280 deletions
|
|
@ -144,7 +144,7 @@ export default Vue.extend({
|
|||
|
||||
// Draw map
|
||||
if (this.p.geo) {
|
||||
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.client_settings.showMaps : true;
|
||||
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.account.client_settings.showMaps : true;
|
||||
if (shouldShowMap) {
|
||||
(this as any).os.getGoogleMaps().then(maps => {
|
||||
const uluru = new maps.LatLng(this.p.geo.latitude, this.p.geo.longitude);
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ export default Vue.extend({
|
|||
},
|
||||
post() {
|
||||
this.posting = true;
|
||||
const viaMobile = (this as any).os.i.client_settings.disableViaMobile !== true;
|
||||
const viaMobile = (this as any).os.i.account.client_settings.disableViaMobile !== true;
|
||||
(this as any).api('posts/create', {
|
||||
text: this.text == '' ? undefined : this.text,
|
||||
media_ids: this.files.length > 0 ? this.files.map(f => f.id) : undefined,
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
<div class="main">
|
||||
<header>
|
||||
<router-link class="name" :to="`/${p.user.username}`">{{ p.user.name }}</router-link>
|
||||
<span class="is-bot" v-if="p.user.is_bot">bot</span>
|
||||
<span class="is-bot" v-if="p.user.account.is_bot">bot</span>
|
||||
<span class="username">@{{ p.user.username }}</span>
|
||||
<div class="info">
|
||||
<span class="mobile" v-if="p.via_mobile">%fa:mobile-alt%</span>
|
||||
|
|
@ -137,7 +137,7 @@ export default Vue.extend({
|
|||
|
||||
// Draw map
|
||||
if (this.p.geo) {
|
||||
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.client_settings.showMaps : true;
|
||||
const shouldShowMap = (this as any).os.isSignedIn ? (this as any).os.i.account.client_settings.showMaps : true;
|
||||
if (shouldShowMap) {
|
||||
(this as any).os.getGoogleMaps().then(maps => {
|
||||
const uluru = new maps.LatLng(this.p.geo.latitude, this.p.geo.longitude);
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ export default Vue.extend({
|
|||
}
|
||||
});
|
||||
|
||||
const ago = (new Date().getTime() - new Date((this as any).os.i.last_used_at).getTime()) / 1000
|
||||
const ago = (new Date().getTime() - new Date((this as any).os.i.account.last_used_at).getTime()) / 1000
|
||||
const isHisasiburi = ago >= 3600;
|
||||
(this as any).os.i.last_used_at = new Date();
|
||||
(this as any).os.i.account.last_used_at = new Date();
|
||||
if (isHisasiburi) {
|
||||
(this.$refs.welcomeback as any).style.display = 'block';
|
||||
(this.$refs.main as any).style.overflow = 'hidden';
|
||||
|
|
|
|||
|
|
@ -82,8 +82,8 @@ export default Vue.extend({
|
|||
};
|
||||
},
|
||||
created() {
|
||||
if ((this as any).os.i.client_settings.mobile_home == null) {
|
||||
Vue.set((this as any).os.i.client_settings, 'mobile_home', [{
|
||||
if ((this as any).os.i.account.client_settings.mobile_home == null) {
|
||||
Vue.set((this as any).os.i.account.client_settings, 'mobile_home', [{
|
||||
name: 'calendar',
|
||||
id: 'a', data: {}
|
||||
}, {
|
||||
|
|
@ -105,14 +105,14 @@ export default Vue.extend({
|
|||
name: 'version',
|
||||
id: 'g', data: {}
|
||||
}]);
|
||||
this.widgets = (this as any).os.i.client_settings.mobile_home;
|
||||
this.widgets = (this as any).os.i.account.client_settings.mobile_home;
|
||||
this.saveHome();
|
||||
} else {
|
||||
this.widgets = (this as any).os.i.client_settings.mobile_home;
|
||||
this.widgets = (this as any).os.i.account.client_settings.mobile_home;
|
||||
}
|
||||
|
||||
this.$watch('os.i.client_settings', i => {
|
||||
this.widgets = (this as any).os.i.client_settings.mobile_home;
|
||||
this.$watch('os.i.account.client_settings', i => {
|
||||
this.widgets = (this as any).os.i.account.client_settings.mobile_home;
|
||||
}, {
|
||||
deep: true
|
||||
});
|
||||
|
|
@ -157,15 +157,15 @@ export default Vue.extend({
|
|||
},
|
||||
onHomeUpdated(data) {
|
||||
if (data.home) {
|
||||
(this as any).os.i.client_settings.mobile_home = data.home;
|
||||
(this as any).os.i.account.client_settings.mobile_home = data.home;
|
||||
this.widgets = data.home;
|
||||
} else {
|
||||
const w = (this as any).os.i.client_settings.mobile_home.find(w => w.id == data.id);
|
||||
const w = (this as any).os.i.account.client_settings.mobile_home.find(w => w.id == data.id);
|
||||
if (w != null) {
|
||||
w.data = data.data;
|
||||
this.$refs[w.id][0].preventSave = true;
|
||||
this.$refs[w.id][0].props = w.data;
|
||||
this.widgets = (this as any).os.i.client_settings.mobile_home;
|
||||
this.widgets = (this as any).os.i.account.client_settings.mobile_home;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -194,7 +194,7 @@ export default Vue.extend({
|
|||
this.saveHome();
|
||||
},
|
||||
saveHome() {
|
||||
(this as any).os.i.client_settings.mobile_home = this.widgets;
|
||||
(this as any).os.i.account.client_settings.mobile_home = this.widgets;
|
||||
(this as any).api('i/update_mobile_home', {
|
||||
home: this.widgets
|
||||
});
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ export default Vue.extend({
|
|||
},
|
||||
created() {
|
||||
this.name = (this as any).os.i.name;
|
||||
this.location = (this as any).os.i.profile.location;
|
||||
this.location = (this as any).os.i.account.profile.location;
|
||||
this.description = (this as any).os.i.description;
|
||||
this.birthday = (this as any).os.i.profile.birthday;
|
||||
this.birthday = (this as any).os.i.account.profile.birthday;
|
||||
},
|
||||
mounted() {
|
||||
document.title = 'Misskey | %i18n:mobile.tags.mk-profile-setting-page.title%';
|
||||
|
|
|
|||
|
|
@ -18,11 +18,11 @@
|
|||
</div>
|
||||
<div class="description">{{ user.description }}</div>
|
||||
<div class="info">
|
||||
<p class="location" v-if="user.profile.location">
|
||||
%fa:map-marker%{{ user.profile.location }}
|
||||
<p class="location" v-if="user.account.profile.location">
|
||||
%fa:map-marker%{{ user.account.profile.location }}
|
||||
</p>
|
||||
<p class="birthday" v-if="user.profile.birthday">
|
||||
%fa:birthday-cake%{{ user.profile.birthday.replace('-', '年').replace('-', '月') + '日' }} ({{ age }}歳)
|
||||
<p class="birthday" v-if="user.account.profile.birthday">
|
||||
%fa:birthday-cake%{{ user.account.profile.birthday.replace('-', '年').replace('-', '月') + '日' }} ({{ age }}歳)
|
||||
</p>
|
||||
</div>
|
||||
<div class="status">
|
||||
|
|
@ -74,7 +74,7 @@ export default Vue.extend({
|
|||
},
|
||||
computed: {
|
||||
age(): number {
|
||||
return age(this.user.profile.birthday);
|
||||
return age(this.user.account.profile.birthday);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
<x-followers-you-know :user="user"/>
|
||||
</div>
|
||||
</section>
|
||||
<p>%i18n:mobile.tags.mk-user-overview.last-used-at%: <b><mk-time :time="user.last_used_at"/></b></p>
|
||||
<p>%i18n:mobile.tags.mk-user-overview.last-used-at%: <b><mk-time :time="user.account.last_used_at"/></b></p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<form @submit.prevent="onSubmit">
|
||||
<input v-model="username" type="text" pattern="^[a-zA-Z0-9-]+$" placeholder="ユーザー名" autofocus required @change="onUsernameChange"/>
|
||||
<input v-model="password" type="password" placeholder="パスワード" required/>
|
||||
<input v-if="user && user.two_factor_enabled" v-model="token" type="number" placeholder="トークン" required/>
|
||||
<input v-if="user && user.account.two_factor_enabled" v-model="token" type="number" placeholder="トークン" required/>
|
||||
<button type="submit" :disabled="signing">{{ signing ? 'ログインしています' : 'ログイン' }}</button>
|
||||
</form>
|
||||
<div>
|
||||
|
|
@ -70,7 +70,7 @@ export default Vue.extend({
|
|||
(this as any).api('signin', {
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
token: this.user && this.user.two_factor_enabled ? this.token : undefined
|
||||
token: this.user && this.user.account.two_factor_enabled ? this.token : undefined
|
||||
}).then(() => {
|
||||
location.reload();
|
||||
}).catch(() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue