Allow name property of user to be null

This commit is contained in:
Akihiko Odaki
2018-04-06 01:36:34 +09:00
parent 46e8fd44c1
commit f0e8e6392b
52 changed files with 311 additions and 107 deletions

View File

@ -1,7 +1,7 @@
<template>
<mk-window width="400px" height="550px" @closed="$destroy">
<span slot="header" :class="$style.header">
<img :src="`${user.avatarUrl}?thumbnail&size=64`" alt=""/>{{ user.name }}のフォロワー
<img :src="`${user.avatarUrl}?thumbnail&size=64`" alt=""/>{{ name }}のフォロワー
</span>
<mk-followers :user="user"/>
</mk-window>
@ -9,8 +9,15 @@
<script lang="ts">
import Vue from 'vue';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
props: ['user']
props: ['user'],
computed {
name() {
return getUserName(this.user);
}
}
});
</script>

View File

@ -1,7 +1,7 @@
<template>
<mk-window width="400px" height="550px" @closed="$destroy">
<span slot="header" :class="$style.header">
<img :src="`${user.avatarUrl}?thumbnail&size=64`" alt=""/>{{ user.name }}のフォロー
<img :src="`${user.avatarUrl}?thumbnail&size=64`" alt=""/>{{ name }}のフォロー
</span>
<mk-following :user="user"/>
</mk-window>
@ -9,8 +9,15 @@
<script lang="ts">
import Vue from 'vue';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
props: ['user']
props: ['user'],
computed: {
name() {
return getUserName(this.user);
}
}
});
</script>

View File

@ -7,7 +7,7 @@
<img class="avatar" :src="`${user.avatarUrl}?thumbnail&size=42`" alt="" v-user-preview="user.id"/>
</router-link>
<div class="body">
<router-link class="name" :to="`/@${getAcct(user)}`" v-user-preview="user.id">{{ user.name }}</router-link>
<router-link class="name" :to="`/@${getAcct(user)}`" v-user-preview="user.id">{{ getUserName(user) }}</router-link>
<p class="username">@{{ getAcct(user) }}</p>
</div>
<mk-follow-button :user="user"/>
@ -23,6 +23,7 @@
<script lang="ts">
import Vue from 'vue';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
data() {
@ -38,6 +39,7 @@ export default Vue.extend({
},
methods: {
getAcct,
getUserName,
fetch() {
this.fetching = true;
this.users = [];

View File

@ -1,6 +1,6 @@
<template>
<mk-window ref="window" width="500px" height="560px" :popout-url="popout" @closed="$destroy">
<span slot="header" :class="$style.header">%fa:comments%メッセージ: {{ user.name }}</span>
<span slot="header" :class="$style.header">%fa:comments%メッセージ: {{ name }}</span>
<mk-messaging-room :user="user" :class="$style.content"/>
</mk-window>
</template>
@ -9,10 +9,14 @@
import Vue from 'vue';
import { url } from '../../../config';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
props: ['user'],
computed: {
name(): string {
return getUserName(this.user);
},
popout(): string {
return `${url}/i/messaging/${getAcct(this.user)}`;
}

View File

@ -11,7 +11,7 @@
<div class="text">
<p>
<mk-reaction-icon :reaction="notification.reaction"/>
<router-link :to="`/@${getAcct(notification.user)}`" v-user-preview="notification.user.id">{{ notification.user.name }}</router-link>
<router-link :to="`/@${getAcct(notification.user)}`" v-user-preview="notification.user.id">{{ getUserName(notification.user) }}</router-link>
</p>
<router-link class="post-ref" :to="`/@${getAcct(notification.post.user)}/${notification.post.id}`">
%fa:quote-left%{{ getPostSummary(notification.post) }}%fa:quote-right%
@ -24,7 +24,7 @@
</router-link>
<div class="text">
<p>%fa:retweet%
<router-link :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.userId">{{ notification.post.user.name }}</router-link>
<router-link :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.userId">{{ getUserName(notification.post.user) }}</router-link>
</p>
<router-link class="post-ref" :to="`/@${getAcct(notification.post.user)}/${notification.post.id}`">
%fa:quote-left%{{ getPostSummary(notification.post.repost) }}%fa:quote-right%
@ -37,7 +37,7 @@
</router-link>
<div class="text">
<p>%fa:quote-left%
<router-link :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.userId">{{ notification.post.user.name }}</router-link>
<router-link :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.userId">{{ getUserName(notification.post.user) }}</router-link>
</p>
<router-link class="post-preview" :to="`/@${getAcct(notification.post.user)}/${notification.post.id}`">{{ getPostSummary(notification.post) }}</router-link>
</div>
@ -48,7 +48,7 @@
</router-link>
<div class="text">
<p>%fa:user-plus%
<router-link :to="`/@${getAcct(notification.user)}`" v-user-preview="notification.user.id">{{ notification.user.name }}</router-link>
<router-link :to="`/@${getAcct(notification.user)}`" v-user-preview="notification.user.id">{{ getUserName(notification.user) }}</router-link>
</p>
</div>
</template>
@ -58,7 +58,7 @@
</router-link>
<div class="text">
<p>%fa:reply%
<router-link :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.userId">{{ notification.post.user.name }}</router-link>
<router-link :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.userId">{{ getUserName(notification.post.user) }}</router-link>
</p>
<router-link class="post-preview" :to="`/@${getAcct(notification.post.user)}/${notification.post.id}`">{{ getPostSummary(notification.post) }}</router-link>
</div>
@ -69,7 +69,7 @@
</router-link>
<div class="text">
<p>%fa:at%
<router-link :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.userId">{{ notification.post.user.name }}</router-link>
<router-link :to="`/@${getAcct(notification.post.user)}`" v-user-preview="notification.post.userId">{{ getUserName(notification.post.user) }}</router-link>
</p>
<a class="post-preview" :href="`/@${getAcct(notification.post.user)}/${notification.post.id}`">{{ getPostSummary(notification.post) }}</a>
</div>
@ -79,7 +79,7 @@
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=48`" alt="avatar"/>
</router-link>
<div class="text">
<p>%fa:chart-pie%<a :href="`/@${getAcct(notification.user)}`" v-user-preview="notification.user.id">{{ notification.user.name }}</a></p>
<p>%fa:chart-pie%<a :href="`/@${getAcct(notification.user)}`" v-user-preview="notification.user.id">{{ getUserName(notification.user) }}</a></p>
<router-link class="post-ref" :to="`/@${getAcct(notification.post.user)}/${notification.post.id}`">
%fa:quote-left%{{ getPostSummary(notification.post) }}%fa:quote-right%
</router-link>
@ -104,6 +104,7 @@
import Vue from 'vue';
import getAcct from '../../../../../acct/render';
import getPostSummary from '../../../../../renderers/get-post-summary';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
data() {
@ -154,6 +155,7 @@ export default Vue.extend({
},
methods: {
getAcct,
getUserName,
fetchMoreNotifications() {
this.fetchingMoreNotifications = true;

View File

@ -6,7 +6,7 @@
<div class="main">
<header>
<div class="left">
<router-link class="name" :to="`/@${acct}`" v-user-preview="post.userId">{{ post.user.name }}</router-link>
<router-link class="name" :to="`/@${acct}`" v-user-preview="post.userId">{{ getUserName(post.user) }}</router-link>
<span class="username">@{{ acct }}</span>
</div>
<div class="right">
@ -29,6 +29,7 @@
import Vue from 'vue';
import dateStringify from '../../../common/scripts/date-stringify';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
props: ['post'],
@ -36,6 +37,9 @@ export default Vue.extend({
acct() {
return getAcct(this.post.user);
},
name() {
return getUserName(this.post.user);
},
title(): string {
return dateStringify(this.post.createdAt);
}

View File

@ -22,7 +22,7 @@
<img class="avatar" :src="`${post.user.avatarUrl}?thumbnail&size=32`" alt="avatar"/>
</router-link>
%fa:retweet%
<router-link class="name" :href="`/@${acct}`">{{ post.user.name }}</router-link>
<router-link class="name" :href="`/@${acct}`">{{ getUserName(post.user) }}</router-link>
がRepost
</p>
</div>
@ -31,7 +31,7 @@
<img class="avatar" :src="`${p.user.avatarUrl}?thumbnail&size=64`" alt="avatar" v-user-preview="p.user.id"/>
</router-link>
<header>
<router-link class="name" :to="`/@${pAcct}`" v-user-preview="p.user.id">{{ p.user.name }}</router-link>
<router-link class="name" :to="`/@${pAcct}`" v-user-preview="p.user.id">{{ getUserName(p.user) }}</router-link>
<span class="username">@{{ pAcct }}</span>
<router-link class="time" :to="`/@${pAcct}/${p.id}`">
<mk-time :time="p.createdAt"/>
@ -79,6 +79,7 @@
import Vue from 'vue';
import dateStringify from '../../../common/scripts/date-stringify';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
import parse from '../../../../../text/parse';
import MkPostFormWindow from './post-form-window.vue';
@ -133,9 +134,15 @@ export default Vue.extend({
acct(): string {
return getAcct(this.post.user);
},
name(): string {
return getUserName(this.post.user);
},
pAcct(): string {
return getAcct(this.p.user);
},
pName(): string {
return getUserName(this.p.user);
},
urls(): string[] {
if (this.p.text) {
const ast = parse(this.p.text);

View File

@ -5,7 +5,7 @@
</router-link>
<div class="main">
<header>
<router-link class="name" :to="`/@${acct}`" v-user-preview="post.userId">{{ post.user.name }}</router-link>
<router-link class="name" :to="`/@${acct}`" v-user-preview="post.userId">{{ name }}</router-link>
<span class="username">@{{ acct }}</span>
<router-link class="time" :to="`/@${acct}/${post.id}`">
<mk-time :time="post.createdAt"/>
@ -22,6 +22,7 @@
import Vue from 'vue';
import dateStringify from '../../../common/scripts/date-stringify';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
props: ['post'],
@ -29,6 +30,9 @@ export default Vue.extend({
acct() {
return getAcct(this.post.user);
},
name() {
return getUserName(this.post.user);
},
title(): string {
return dateStringify(this.post.createdAt);
}

View File

@ -5,7 +5,7 @@
</router-link>
<div class="main">
<header>
<router-link class="name" :to="`/@${acct}`" v-user-preview="post.userId">{{ post.user.name }}</router-link>
<router-link class="name" :to="`/@${acct}`" v-user-preview="post.userId">{{ name }}</router-link>
<span class="username">@{{ acct }}</span>
<router-link class="created-at" :to="`/@${acct}/${post.id}`">
<mk-time :time="post.createdAt"/>
@ -22,6 +22,7 @@
import Vue from 'vue';
import dateStringify from '../../../common/scripts/date-stringify';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
props: ['post'],
@ -29,6 +30,9 @@ export default Vue.extend({
acct() {
return getAcct(this.post.user);
},
name(): string {
return getUserName(this.post.user);
},
title(): string {
return dateStringify(this.post.createdAt);
}

View File

@ -10,7 +10,7 @@
</router-link>
%fa:retweet%
<span>{{ '%i18n:desktop.tags.mk-timeline-post.reposted-by%'.substr(0, '%i18n:desktop.tags.mk-timeline-post.reposted-by%'.indexOf('{')) }}</span>
<a class="name" :href="`/@${acct}`" v-user-preview="post.userId">{{ post.user.name }}</a>
<a class="name" :href="`/@${acct}`" v-user-preview="post.userId">{{ getUserName(post.user) }}</a>
<span>{{ '%i18n:desktop.tags.mk-timeline-post.reposted-by%'.substr('%i18n:desktop.tags.mk-timeline-post.reposted-by%'.indexOf('}') + 1) }}</span>
</p>
<mk-time :time="post.createdAt"/>
@ -86,6 +86,7 @@
import Vue from 'vue';
import dateStringify from '../../../common/scripts/date-stringify';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
import parse from '../../../../../text/parse';
import MkPostFormWindow from './post-form-window.vue';
@ -124,6 +125,9 @@ export default Vue.extend({
acct(): string {
return getAcct(this.p.user);
},
name(): string {
return getUserName(this.p.user);
},
isRepost(): boolean {
return (this.post.repost &&
this.post.text == null &&

View File

@ -5,7 +5,7 @@
</div>
<div class="users" v-if="users.length != 0">
<div v-for="user in users" :key="user.id">
<p><b>{{ user.name }}</b> @{{ getAcct(user) }}</p>
<p><b>{{ getUserName(user) }}</b> @{{ getAcct(user) }}</p>
</div>
</div>
</div>
@ -14,6 +14,7 @@
<script lang="ts">
import Vue from 'vue';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
data() {
@ -23,7 +24,8 @@ export default Vue.extend({
};
},
methods: {
getAcct
getAcct,
getUserName
},
mounted() {
(this as any).api('mute/list').then(x => {

View File

@ -42,7 +42,7 @@ export default Vue.extend({
};
},
created() {
this.name = (this as any).os.i.name;
this.name = (this as any).os.i.name || '';
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.account.profile.birthday;
@ -53,7 +53,7 @@ export default Vue.extend({
},
save() {
(this as any).api('i/update', {
name: this.name,
name: this.name || null,
location: this.location || null,
description: this.description || null,
birthday: this.birthday || null

View File

@ -4,7 +4,7 @@
<div class="main" ref="main">
<div class="backdrop"></div>
<div class="main">
<p ref="welcomeback" v-if="os.isSignedIn">おかえりなさい<b>{{ os.i.name }}</b>さん</p>
<p ref="welcomeback" v-if="os.isSignedIn">おかえりなさい<b>{{ name }}</b>さん</p>
<div class="container" ref="mainContainer">
<div class="left">
<x-nav/>
@ -33,7 +33,14 @@ import XNotifications from './ui.header.notifications.vue';
import XPost from './ui.header.post.vue';
import XClock from './ui.header.clock.vue';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
computed: {
name() {
return getUserName(this.os.i);
}
},
components: {
XNav,
XSearch,

View File

@ -5,7 +5,7 @@
</router-link>
<div class="main">
<header>
<router-link class="name" :to="`/@${acct}`" v-user-preview="user.id">{{ user.name }}</router-link>
<router-link class="name" :to="`/@${acct}`" v-user-preview="user.id">{{ name }}</router-link>
<span class="username">@{{ acct }}</span>
</header>
<div class="body">
@ -20,12 +20,16 @@
<script lang="ts">
import Vue from 'vue';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
props: ['user'],
computed: {
acct() {
return getAcct(this.user);
},
name() {
return getUserName(this.user);
}
}
});