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

@ -165,7 +165,7 @@
<mk-channel-post>
<header>
<a class="index" @click="reply">{ post.index }:</a>
<a class="name" href={ _URL_ + '/@' + acct }><b>{ post.user.name }</b></a>
<a class="name" href={ _URL_ + '/@' + acct }><b>{ getUserName(post.user) }</b></a>
<mk-time time={ post.createdAt }/>
<mk-time time={ post.createdAt } mode="detail"/>
<span>ID:<i>{ acct }</i></span>
@ -230,10 +230,12 @@
</style>
<script lang="typescript">
import getAcct from '../../../../acct/render';
import getUserName from '../../../../renderers/get-user-name';
this.post = this.opts.post;
this.form = this.opts.form;
this.acct = getAcct(this.post.user);
this.name = getUserName(this.post.user);
this.reply = () => {
this.form.update({
@ -244,7 +246,7 @@
</mk-channel-post>
<mk-channel-form>
<p v-if="reply"><b>&gt;&gt;{ reply.index }</b> ({ reply.user.name }): <a @click="clearReply">[x]</a></p>
<p v-if="reply"><b>&gt;&gt;{ reply.index }</b> ({ getUserName(reply.user) }): <a @click="clearReply">[x]</a></p>
<textarea ref="text" disabled={ wait } oninput={ update } onkeydown={ onkeydown } onpaste={ onpaste } placeholder="%i18n:ch.tags.mk-channel-form.textarea%"></textarea>
<div class="actions">
<button @click="selectFile">%fa:upload%%i18n:ch.tags.mk-channel-form.upload%</button>
@ -286,6 +288,8 @@
</style>
<script lang="typescript">
import getUserName from '../../../../renderers/get-user-name';
this.mixin('api');
this.channel = this.opts.channel;
@ -373,6 +377,8 @@
}
});
};
this.getUserName = getUserName;
</script>
</mk-channel-form>

View File

@ -1,5 +1,6 @@
import getPostSummary from '../../../../renderers/get-post-summary';
import getReactionEmoji from '../../../../renderers/get-reaction-emoji';
import getUserName from '../../../../renderers/get-user-name';
type Notification = {
title: string;
@ -21,35 +22,35 @@ export default function(type, data): Notification {
case 'mention':
return {
title: `${data.user.name}さんから:`,
title: `${getUserName(data.user)}さんから:`,
body: getPostSummary(data),
icon: data.user.avatarUrl + '?thumbnail&size=64'
};
case 'reply':
return {
title: `${data.user.name}さんから返信:`,
title: `${getUserName(data.user)}さんから返信:`,
body: getPostSummary(data),
icon: data.user.avatarUrl + '?thumbnail&size=64'
};
case 'quote':
return {
title: `${data.user.name}さんが引用:`,
title: `${getUserName(data.user)}さんが引用:`,
body: getPostSummary(data),
icon: data.user.avatarUrl + '?thumbnail&size=64'
};
case 'reaction':
return {
title: `${data.user.name}: ${getReactionEmoji(data.reaction)}:`,
title: `${getUserName(data.user)}: ${getReactionEmoji(data.reaction)}:`,
body: getPostSummary(data.post),
icon: data.user.avatarUrl + '?thumbnail&size=64'
};
case 'unread_messaging_message':
return {
title: `${data.user.name}さんからメッセージ:`,
title: `${getUserName(data.user)}さんからメッセージ:`,
body: data.text, // TODO: getMessagingMessageSummary(data),
icon: data.user.avatarUrl + '?thumbnail&size=64'
};
@ -57,7 +58,7 @@ export default function(type, data): Notification {
case 'othello_invited':
return {
title: '対局への招待があります',
body: `${data.parent.name}さんから`,
body: `${getUserName(data.parent)}さんから`,
icon: data.parent.avatarUrl + '?thumbnail&size=64'
};

View File

@ -3,7 +3,7 @@
<ol class="users" ref="suggests" v-if="users.length > 0">
<li v-for="user in users" @click="complete(type, user)" @keydown="onKeydown" tabindex="-1">
<img class="avatar" :src="`${user.avatarUrl}?thumbnail&size=32`" alt=""/>
<span class="name">{{ user.name }}</span>
<span class="name">{{ getUserName(user) }}</span>
<span class="username">@{{ getAcct(user) }}</span>
</li>
</ol>
@ -22,6 +22,7 @@ import Vue from 'vue';
import * as emojilib from 'emojilib';
import contains from '../../../common/scripts/contains';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
const lib = Object.entries(emojilib.lib).filter((x: any) => {
return x[1].category != 'flags';
@ -107,6 +108,7 @@ export default Vue.extend({
},
methods: {
getAcct,
getUserName,
exec() {
this.select = -1;
if (this.$refs.suggests) {

View File

@ -14,7 +14,7 @@
tabindex="-1"
>
<img class="avatar" :src="`${user.avatarUrl}?thumbnail&size=32`" alt=""/>
<span class="name">{{ user.name }}</span>
<span class="name">{{ getUserName(user) }}</span>
<span class="username">@{{ getAcct(user) }}</span>
</li>
</ol>
@ -33,7 +33,7 @@
<div>
<img class="avatar" :src="`${isMe(message) ? message.recipient.avatarUrl : message.user.avatarUrl}?thumbnail&size=64`" alt=""/>
<header>
<span class="name">{{ isMe(message) ? message.recipient.name : message.user.name }}</span>
<span class="name">{{ getUserName(isMe(message) ? message.recipient : message.user) }}</span>
<span class="username">@{{ getAcct(isMe(message) ? message.recipient : message.user) }}</span>
<mk-time :time="message.createdAt"/>
</header>
@ -52,6 +52,7 @@
<script lang="ts">
import Vue from 'vue';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
props: {
@ -94,6 +95,7 @@ export default Vue.extend({
},
methods: {
getAcct,
getUserName,
isMe(message) {
return message.userId == (this as any).os.i.id;
},

View File

@ -6,7 +6,7 @@
</router-link>
<div class="body">
<header>
<router-link class="name" :to="`/@${getAcct(post.user)}`" v-user-preview="post.user.id">{{ post.user.name }}</router-link>
<router-link class="name" :to="`/@${getAcct(post.user)}`" v-user-preview="post.user.id">{{ getUserName(post.user) }}</router-link>
<span class="username">@{{ getAcct(post.user) }}</span>
<div class="info">
<router-link class="created-at" :to="`/@${getAcct(post.user)}/${post.id}`">
@ -25,6 +25,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(cb?) {
this.fetching = true;
(this as any).api('posts', {

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);
}
}
});

View File

@ -8,6 +8,7 @@
import Vue from 'vue';
import Progress from '../../../common/scripts/loading';
import parseAcct from '../../../../../acct/parse';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
data() {
@ -34,7 +35,7 @@ export default Vue.extend({
this.user = user;
this.fetching = false;
document.title = 'メッセージ: ' + this.user.name;
document.title = 'メッセージ: ' + getUserName(this.user);
Progress.done();
});

View File

@ -4,7 +4,7 @@
<p class="initializing" v-if="fetching">%fa:spinner .pulse .fw%%i18n:desktop.tags.mk-user.followers-you-know.loading%<mk-ellipsis/></p>
<div v-if="!fetching && users.length > 0">
<router-link v-for="user in users" :to="`/@${getAcct(user)}`" :key="user.id">
<img :src="`${user.avatarUrl}?thumbnail&size=64`" :alt="user.name" v-user-preview="user.id"/>
<img :src="`${user.avatarUrl}?thumbnail&size=64`" :alt="getUserName(user)" v-user-preview="user.id"/>
</router-link>
</div>
<p class="empty" v-if="!fetching && users.length == 0">%i18n:desktop.tags.mk-user.followers-you-know.no-users%</p>
@ -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({
props: ['user'],
@ -24,7 +25,8 @@ export default Vue.extend({
};
},
method() {
getAcct
getAcct,
getUserName
},
mounted() {
(this as any).api('users/followers', {

View File

@ -7,7 +7,7 @@
<div class="container">
<img class="avatar" :src="`${user.avatarUrl}?thumbnail&size=150`" alt="avatar"/>
<div class="title">
<p class="name">{{ user.name }}</p>
<p class="name">{{ name }}</p>
<p class="username">@{{ acct }}</p>
<p class="location" v-if="user.host === null && user.account.profile.location">%fa:map-marker%{{ user.account.profile.location }}</p>
</div>
@ -23,12 +23,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);
}
},
mounted() {

View File

@ -10,6 +10,7 @@
<script lang="ts">
import Vue from 'vue';
import parseAcct from '../../../../../../acct/parse';
import getUserName from '../../../../../../renderers/get-user-name';
import Progress from '../../../../common/scripts/loading';
import XHeader from './user.header.vue';
import XHome from './user.home.vue';
@ -44,7 +45,7 @@ export default Vue.extend({
this.user = user;
this.fetching = false;
Progress.done();
document.title = user.name + ' | Misskey';
document.title = getUserName(user) + ' | Misskey';
});
}
}

View File

@ -2,7 +2,7 @@
<div class="post">
<header>
<a class="index" @click="reply">{{ post.index }}:</a>
<router-link class="name" :to="`/@${acct}`" v-user-preview="post.user.id"><b>{{ post.user.name }}</b></router-link>
<router-link class="name" :to="`/@${acct}`" v-user-preview="post.user.id"><b>{{ name }}</b></router-link>
<span>ID:<i>{{ acct }}</i></span>
</header>
<div>
@ -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: ['post'],
computed: {
acct() {
return getAcct(this.post.user);
},
name() {
return getUserName(this.post.user);
}
},
methods: {

View File

@ -15,19 +15,26 @@
title="クリックでアバター編集"
v-user-preview="os.i.id"
/>
<router-link class="name" :to="`/@${os.i.username}`">{{ os.i.name }}</router-link>
<router-link class="name" :to="`/@${os.i.username}`">{{ name }}</router-link>
<p class="username">@{{ os.i.username }}</p>
</div>
</template>
<script lang="ts">
import define from '../../../common/define-widget';
import getUserName from '../../../../../renderers/get-user-name';
export default define({
name: 'profile',
props: () => ({
design: 0
})
}).extend({
computed: {
name() {
return getUserName(this.os.i);
}
},
methods: {
func() {
if (this.props.design == 2) {

View File

@ -11,7 +11,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"/>
@ -24,6 +24,7 @@
<script lang="ts">
import define from '../../../common/define-widget';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
const limit = 3;
@ -45,6 +46,7 @@ export default define({
},
methods: {
getAcct,
getUserName,
func() {
this.props.compact = !this.props.compact;
},

View File

@ -3,7 +3,7 @@
<template v-if="notification.type == 'reaction'">
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
<div class="text">
<p><mk-reaction-icon :reaction="notification.reaction"/>{{ notification.user.name }}</p>
<p><mk-reaction-icon :reaction="notification.reaction"/>{{ name }}</p>
<p class="post-ref">%fa:quote-left%{{ getPostSummary(notification.post) }}%fa:quote-right%</p>
</div>
</template>
@ -11,7 +11,7 @@
<template v-if="notification.type == 'repost'">
<img class="avatar" :src="`${notification.post.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
<div class="text">
<p>%fa:retweet%{{ notification.post.user.name }}</p>
<p>%fa:retweet%{{ posterName }}</p>
<p class="post-ref">%fa:quote-left%{{ getPostSummary(notification.post.repost) }}%fa:quote-right%</p>
</div>
</template>
@ -19,7 +19,7 @@
<template v-if="notification.type == 'quote'">
<img class="avatar" :src="`${notification.post.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
<div class="text">
<p>%fa:quote-left%{{ notification.post.user.name }}</p>
<p>%fa:quote-left%{{ posterName }}</p>
<p class="post-preview">{{ getPostSummary(notification.post) }}</p>
</div>
</template>
@ -27,14 +27,14 @@
<template v-if="notification.type == 'follow'">
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
<div class="text">
<p>%fa:user-plus%{{ notification.user.name }}</p>
<p>%fa:user-plus%{{ name }}</p>
</div>
</template>
<template v-if="notification.type == 'reply'">
<img class="avatar" :src="`${notification.post.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
<div class="text">
<p>%fa:reply%{{ notification.post.user.name }}</p>
<p>%fa:reply%{{ posterName }}</p>
<p class="post-preview">{{ getPostSummary(notification.post) }}</p>
</div>
</template>
@ -42,7 +42,7 @@
<template v-if="notification.type == 'mention'">
<img class="avatar" :src="`${notification.post.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
<div class="text">
<p>%fa:at%{{ notification.post.user.name }}</p>
<p>%fa:at%{{ posterName }}</p>
<p class="post-preview">{{ getPostSummary(notification.post) }}</p>
</div>
</template>
@ -50,7 +50,7 @@
<template v-if="notification.type == 'poll_vote'">
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
<div class="text">
<p>%fa:chart-pie%{{ notification.user.name }}</p>
<p>%fa:chart-pie%{{ name }}</p>
<p class="post-ref">%fa:quote-left%{{ getPostSummary(notification.post) }}%fa:quote-right%</p>
</div>
</template>
@ -60,9 +60,18 @@
<script lang="ts">
import Vue from 'vue';
import getPostSummary from '../../../../../renderers/get-post-summary';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
props: ['notification'],
computed: {
name() {
return getUserName(this.notification.user);
},
posterName() {
return getUserName(this.notification.post.user);
}
},
data() {
return {
getPostSummary

View File

@ -8,7 +8,7 @@
<div class="text">
<p>
<mk-reaction-icon :reaction="notification.reaction"/>
<router-link :to="`/@${acct}`">{{ notification.user.name }}</router-link>
<router-link :to="`/@${acct}`">{{ getUserName(notification.user) }}</router-link>
</p>
<router-link class="post-ref" :to="`/@${acct}/${notification.post.id}`">
%fa:quote-left%{{ getPostSummary(notification.post) }}
@ -25,7 +25,7 @@
<div class="text">
<p>
%fa:retweet%
<router-link :to="`/@${acct}`">{{ notification.post.user.name }}</router-link>
<router-link :to="`/@${acct}`">{{ getUserName(notification.post.user) }}</router-link>
</p>
<router-link class="post-ref" :to="`/@${acct}/${notification.post.id}`">
%fa:quote-left%{{ getPostSummary(notification.post.repost) }}%fa:quote-right%
@ -45,7 +45,7 @@
<div class="text">
<p>
%fa:user-plus%
<router-link :to="`/@${acct}`">{{ notification.user.name }}</router-link>
<router-link :to="`/@${acct}`">{{ getUserName(notification.user) }}</router-link>
</p>
</div>
</div>
@ -66,7 +66,7 @@
<div class="text">
<p>
%fa:chart-pie%
<router-link :to="`/@${acct}`">{{ notification.user.name }}</router-link>
<router-link :to="`/@${acct}`">{{ getUserName(notification.user) }}</router-link>
</p>
<router-link class="post-ref" :to="`/@${acct}/${notification.post.id}`">
%fa:quote-left%{{ getPostSummary(notification.post) }}%fa:quote-right%
@ -80,12 +80,19 @@
import Vue from 'vue';
import getPostSummary from '../../../../../renderers/get-post-summary';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
props: ['notification'],
computed: {
acct() {
return getAcct(this.notification.user);
},
name() {
return getUserName(this.notification.user);
},
posterName() {
return getUserName(this.notification.post.user);
}
},
data() {

View File

@ -2,7 +2,7 @@
<div class="mk-post-card">
<a :href="`/@${acct}/${post.id}`">
<header>
<img :src="`${acct}?thumbnail&size=64`" alt="avatar"/><h3>{{ post.user.name }}</h3>
<img :src="`${acct}?thumbnail&size=64`" alt="avatar"/><h3>{{ name }}</h3>
</header>
<div>
{{ text }}
@ -16,6 +16,7 @@
import Vue from 'vue';
import summary from '../../../../../renderers/get-post-summary';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
props: ['post'],
@ -23,6 +24,9 @@ export default Vue.extend({
acct() {
return getAcct(this.post.user);
},
name() {
return getUserName(this.post.user);
},
text(): string {
return summary(this.post);
}

View File

@ -5,7 +5,7 @@
</router-link>
<div class="main">
<header>
<router-link class="name" :to="`/@${acct}`">{{ post.user.name }}</router-link>
<router-link class="name" :to="`/@${acct}`">{{ getUserName(post.user) }}</router-link>
<span class="username">@{{ acct }}</span>
<router-link class="time" :to="`/@${acct}/${post.id}`">
<mk-time :time="post.createdAt"/>
@ -21,12 +21,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: ['post'],
computed: {
acct() {
return getAcct(this.post.user);
},
name() {
return getUserName(this.post.user);
}
}
});

View File

@ -22,7 +22,7 @@
</router-link>
%fa:retweet%
<router-link class="name" :to="`/@${acct}`">
{{ post.user.name }}
{{ name }}
</router-link>
がRepost
</p>
@ -33,7 +33,7 @@
<img class="avatar" :src="`${p.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
</router-link>
<div>
<router-link class="name" :to="`/@${pAcct}`">{{ p.user.name }}</router-link>
<router-link class="name" :to="`/@${pAcct}`">{{ pName }}</router-link>
<span class="username">@{{ pAcct }}</span>
</div>
</header>
@ -81,6 +81,7 @@
<script lang="ts">
import Vue from 'vue';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
import parse from '../../../../../text/parse';
import MkPostMenu from '../../../common/views/components/post-menu.vue';
@ -114,9 +115,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);
},
isRepost(): boolean {
return (this.post.repost &&
this.post.text == null &&

View File

@ -5,7 +5,7 @@
</router-link>
<div class="main">
<header>
<router-link class="name" :to="`/@${acct}`">{{ post.user.name }}</router-link>
<router-link class="name" :to="`/@${acct}`">{{ name }}</router-link>
<span class="username">@{{ acct }}</span>
<router-link class="time" :to="`/@${acct}/${post.id}`">
<mk-time :time="post.createdAt"/>
@ -21,12 +21,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: ['post'],
computed: {
acct() {
return getAcct(this.post.user);
},
name() {
return getUserName(this.post.user);
}
}
});

View File

@ -5,7 +5,7 @@
</router-link>
<div class="main">
<header>
<router-link class="name" :to="`/@${acct}`">{{ post.user.name }}</router-link>
<router-link class="name" :to="`/@${acct}`">{{ getUserName(post.user) }}</router-link>
<span class="username">@{{ acct }}</span>
<router-link class="created-at" :to="`/@${acct}/${post.id}`">
<mk-time :time="post.createdAt"/>
@ -21,12 +21,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: ['post'],
computed: {
acct() {
return getAcct(this.post.user);
},
name() {
return getUserName(this.post.user);
}
}
});

View File

@ -10,7 +10,7 @@
</router-link>
%fa:retweet%
<span>{{ '%i18n:mobile.tags.mk-timeline-post.reposted-by%'.substr(0, '%i18n:mobile.tags.mk-timeline-post.reposted-by%'.indexOf('{')) }}</span>
<router-link class="name" :to="`/@${acct}`">{{ post.user.name }}</router-link>
<router-link class="name" :to="`/@${acct}`">{{ name }}</router-link>
<span>{{ '%i18n:mobile.tags.mk-timeline-post.reposted-by%'.substr('%i18n:mobile.tags.mk-timeline-post.reposted-by%'.indexOf('}') + 1) }}</span>
</p>
<mk-time :time="post.createdAt"/>
@ -21,7 +21,7 @@
</router-link>
<div class="main">
<header>
<router-link class="name" :to="`/@${pAcct}`">{{ p.user.name }}</router-link>
<router-link class="name" :to="`/@${pAcct}`">{{ pName }}</router-link>
<span class="is-bot" v-if="p.user.host === null && p.user.account.isBot">bot</span>
<span class="username">@{{ pAcct }}</span>
<div class="info">
@ -78,6 +78,7 @@
<script lang="ts">
import Vue from 'vue';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
import parse from '../../../../../text/parse';
import MkPostMenu from '../../../common/views/components/post-menu.vue';
@ -102,9 +103,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);
},
isRepost(): boolean {
return (this.post.repost &&
this.post.text == null &&

View File

@ -3,7 +3,7 @@
<mk-special-message/>
<div class="main" ref="main">
<div class="backdrop"></div>
<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="content" ref="mainContainer">
<button class="nav" @click="$parent.isDrawerOpening = true">%fa:bars%</button>
<template v-if="hasUnreadNotifications || hasUnreadMessagingMessages || hasGameInvitations">%fa:circle%</template>
@ -19,9 +19,15 @@
<script lang="ts">
import Vue from 'vue';
import * as anime from 'animejs';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
props: ['func'],
computed: {
name() {
return getUserName(this.os.i);
}
},
data() {
return {
hasUnreadNotifications: false,

View File

@ -11,7 +11,7 @@
<div class="body" v-if="isOpen">
<router-link class="me" v-if="os.isSignedIn" :to="`/@${os.i.username}`">
<img class="avatar" :src="`${os.i.avatarUrl}?thumbnail&size=128`" alt="avatar"/>
<p class="name">{{ os.i.name }}</p>
<p class="name">{{ name }}</p>
</router-link>
<div class="links">
<ul>
@ -40,9 +40,15 @@
<script lang="ts">
import Vue from 'vue';
import { docsUrl, chUrl, lang } from '../../../config';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
props: ['isOpen'],
computed: {
name() {
return getUserName(this.os.i);
}
},
data() {
return {
hasUnreadNotifications: false,

View File

@ -5,7 +5,7 @@
<img :src="`${user.avatarUrl}?thumbnail&size=200`" alt="avatar"/>
</a>
</header>
<a class="name" :href="`/@${acct}`" target="_blank">{{ user.name }}</a>
<a class="name" :href="`/@${acct}`" target="_blank">{{ name }}</a>
<p class="username">@{{ acct }}</p>
<mk-follow-button :user="user"/>
</div>
@ -14,12 +14,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);
}
}
});

View File

@ -5,7 +5,7 @@
</router-link>
<div class="main">
<header>
<router-link class="name" :to="`/@${acct}`">{{ user.name }}</router-link>
<router-link class="name" :to="`/@${acct}`">{{ name }}</router-link>
<span class="username">@{{ acct }}</span>
</header>
<div class="body">
@ -18,12 +18,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);
}
}
});

View File

@ -2,7 +2,7 @@
<mk-ui>
<template slot="header" v-if="!fetching">
<img :src="`${user.avatarUrl}?thumbnail&size=64`" alt="">
{{ '%i18n:mobile.tags.mk-user-followers-page.followers-of%'.replace('{}', user.name) }}
{{ '%i18n:mobile.tags.mk-user-followers-page.followers-of%'.replace('{}', name) }}
</template>
<mk-users-list
v-if="!fetching"
@ -20,6 +20,7 @@
import Vue from 'vue';
import Progress from '../../../common/scripts/loading';
import parseAcct from '../../../../../acct/parse';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
data() {
@ -28,6 +29,11 @@ export default Vue.extend({
user: null
};
},
computed: {
name() {
return getUserName(this.user);
}
},
watch: {
$route: 'fetch'
},
@ -46,7 +52,7 @@ export default Vue.extend({
this.user = user;
this.fetching = false;
document.title = '%i18n:mobile.tags.mk-user-followers-page.followers-of%'.replace('{}', user.name) + ' | Misskey';
document.title = '%i18n:mobile.tags.mk-user-followers-page.followers-of%'.replace('{}', this.name) + ' | Misskey';
});
},
onLoaded() {

View File

@ -2,7 +2,7 @@
<mk-ui>
<template slot="header" v-if="!fetching">
<img :src="`${user.avatarUrl}?thumbnail&size=64`" alt="">
{{ '%i18n:mobile.tags.mk-user-following-page.following-of%'.replace('{}', user.name) }}
{{ '%i18n:mobile.tags.mk-user-following-page.following-of%'.replace('{}', name) }}
</template>
<mk-users-list
v-if="!fetching"
@ -20,6 +20,7 @@
import Vue from 'vue';
import Progress from '../../../common/scripts/loading';
import parseAcct from '../../../../../acct/parse';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
data() {
@ -28,6 +29,11 @@ export default Vue.extend({
user: null
};
},
computed: {
name() {
return getUserName(this.user);
}
},
watch: {
$route: 'fetch'
},
@ -46,7 +52,7 @@ export default Vue.extend({
this.user = user;
this.fetching = false;
document.title = '%i18n:mobile.tags.mk-user-followers-page.followers-of%'.replace('{}', user.name) + ' | Misskey';
document.title = '%i18n:mobile.tags.mk-user-followers-page.followers-of%'.replace('{}', this.name) + ' | Misskey';
});
},
onLoaded() {

View File

@ -1,7 +1,7 @@
<template>
<mk-ui>
<span slot="header">
<template v-if="user">%fa:R comments%{{ user.name }}</template>
<template v-if="user">%fa:R comments%{{ name }}</template>
<template v-else><mk-ellipsis/></template>
</span>
<mk-messaging-room v-if="!fetching" :user="user" :is-naked="true"/>
@ -11,6 +11,7 @@
<script lang="ts">
import Vue from 'vue';
import parseAcct from '../../../../../acct/parse';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
data() {
@ -19,6 +20,11 @@ export default Vue.extend({
user: null
};
},
computed: {
name() {
return getUserName(this.user);
}
},
watch: {
$route: 'fetch'
},
@ -33,7 +39,7 @@ export default Vue.extend({
this.user = user;
this.fetching = false;
document.title = `%i18n:mobile.tags.mk-messaging-room-page.message%: ${user.name} | Misskey`;
document.title = `%i18n:mobile.tags.mk-messaging-room-page.message%: ${this.name} | Misskey`;
});
}
}

View File

@ -52,7 +52,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;
@ -94,7 +94,7 @@ export default Vue.extend({
this.saving = true;
(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

@ -2,7 +2,7 @@
<mk-ui>
<span slot="header">%fa:cog%%i18n:mobile.tags.mk-settings-page.settings%</span>
<div :class="$style.content">
<p v-html="'%i18n:mobile.tags.mk-settings.signed-in-as%'.replace('{}', '<b>' + os.i.name + '</b>')"></p>
<p v-html="'%i18n:mobile.tags.mk-settings.signed-in-as%'.replace('{}', '<b>' + name + '</b>')"></p>
<ul>
<li><router-link to="./settings/profile">%fa:user%%i18n:mobile.tags.mk-settings-page.profile%%fa:angle-right%</router-link></li>
<li><router-link to="./settings/authorized-apps">%fa:puzzle-piece%%i18n:mobile.tags.mk-settings-page.applications%%fa:angle-right%</router-link></li>
@ -20,6 +20,7 @@
<script lang="ts">
import Vue from 'vue';
import { version, codename } from '../../../config';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
data() {
@ -28,6 +29,11 @@ export default Vue.extend({
codename
};
},
computed: {
name() {
return getUserName(this.os.i);
}
},
mounted() {
document.title = 'Misskey | %i18n:mobile.tags.mk-settings-page.settings%';
document.documentElement.style.background = '#313a42';

View File

@ -1,6 +1,6 @@
<template>
<mk-ui>
<span slot="header" v-if="!fetching">%fa:user% {{ user.name }}</span>
<span slot="header" v-if="!fetching">%fa:user% {{ user }}</span>
<main v-if="!fetching">
<header>
<div class="banner" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl}?thumbnail&size=1024)` : ''"></div>
@ -12,7 +12,7 @@
<mk-follow-button v-if="os.isSignedIn && os.i.id != user.id" :user="user"/>
</div>
<div class="title">
<h1>{{ user.name }}</h1>
<h1>{{ user }}</h1>
<span class="username">@{{ acct }}</span>
<span class="followed" v-if="user.isFollowed">%i18n:mobile.tags.mk-user.follows-you%</span>
</div>
@ -61,7 +61,7 @@
import Vue from 'vue';
import * as age from 's-age';
import getAcct from '../../../../../acct/render';
import getAcct from '../../../../../acct/parse';
import getUserName from '../../../../../renderers/get-user-name';
import Progress from '../../../common/scripts/loading';
import XHome from './user/home.vue';
@ -82,6 +82,9 @@ export default Vue.extend({
},
age(): number {
return age(this.user.account.profile.birthday);
},
name() {
return getUserName(this.user);
}
},
watch: {
@ -102,7 +105,7 @@ export default Vue.extend({
this.fetching = false;
Progress.done();
document.title = user.name + ' | Misskey';
document.title = this.name + ' | Misskey';
});
}
}

View File

@ -3,7 +3,7 @@
<p class="initializing" v-if="fetching">%fa:spinner .pulse .fw%%i18n:mobile.tags.mk-user-overview-followers-you-know.loading%<mk-ellipsis/></p>
<div v-if="!fetching && users.length > 0">
<a v-for="user in users" :key="user.id" :href="`/@${getAcct(user)}`">
<img :src="`${user.avatarUrl}?thumbnail&size=64`" :alt="user.name"/>
<img :src="`${user.avatarUrl}?thumbnail&size=64`" :alt="getUserName(user)"/>
</a>
</div>
<p class="empty" v-if="!fetching && users.length == 0">%i18n:mobile.tags.mk-user-overview-followers-you-know.no-users%</p>
@ -13,6 +13,7 @@
<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'],
@ -22,6 +23,11 @@ export default Vue.extend({
users: []
};
},
computed: {
name() {
return getUserName(this.user);
}
},
methods: {
getAcct
},

View File

@ -8,15 +8,23 @@
:src="`${os.i.avatarUrl}?thumbnail&size=96`"
alt="avatar"
/>
<router-link :class="$style.name" :to="`/@${os.i.username}`">{{ os.i.name }}</router-link>
<router-link :class="$style.name" :to="`/@${os.i.username}`">{{ name }}</router-link>
</mk-widget-container>
</div>
</template>
<script lang="ts">
import define from '../../../common/define-widget';
import getUserName from '../../../../../renderers/get-user-name';
export default define({
name: 'profile'
}).extend({
computed: {
name() {
return getUserName(this.os.i);
}
}
});
</script>

View File

@ -21,7 +21,7 @@ type IUserBase = {
deletedAt: Date;
followersCount: number;
followingCount: number;
name: string;
name?: string;
postsCount: number;
driveCapacity: number;
username: string;
@ -99,8 +99,8 @@ export function validatePassword(password: string): boolean {
return typeof password == 'string' && password != '';
}
export function isValidName(name: string): boolean {
return typeof name == 'string' && name.length < 30 && name.trim() != '';
export function isValidName(name?: string): boolean {
return name === null || (typeof name == 'string' && name.length < 30 && name.trim() != '');
}
export function isValidDescription(description: string): boolean {

View File

@ -9,6 +9,7 @@
import * as request from 'request-promise-native';
import Othello, { Color } from '../core';
import conf from '../../config';
import getUserName from '../../renderers/get-user-name';
let game;
let form;
@ -47,8 +48,8 @@ process.on('message', async msg => {
const user = game.user1Id == id ? game.user2 : game.user1;
const isSettai = form[0].value === 0;
const text = isSettai
? `?[${user.name}](${conf.url}/@${user.username})さんの接待を始めました!`
: `対局を?[${user.name}](${conf.url}/@${user.username})さんと始めました! (強さ${form[0].value})`;
? `?[${getUserName(user)}](${conf.url}/@${user.username})さんの接待を始めました!`
: `対局を?[${getUserName(user)}](${conf.url}/@${user.username})さんと始めました! (強さ${form[0].value})`;
const res = await request.post(`${conf.api_url}/posts/create`, {
json: { i,
@ -72,15 +73,15 @@ process.on('message', async msg => {
const isSettai = form[0].value === 0;
const text = isSettai
? msg.body.winnerId === null
? `?[${user.name}](${conf.url}/@${user.username})さんに接待で引き分けました...`
? `?[${getUserName(user)}](${conf.url}/@${user.username})さんに接待で引き分けました...`
: msg.body.winnerId == id
? `?[${user.name}](${conf.url}/@${user.username})さんに接待で勝ってしまいました...`
: `?[${user.name}](${conf.url}/@${user.username})さんに接待で負けてあげました♪`
? `?[${getUserName(user)}](${conf.url}/@${user.username})さんに接待で勝ってしまいました...`
: `?[${getUserName(user)}](${conf.url}/@${user.username})さんに接待で負けてあげました♪`
: msg.body.winnerId === null
? `?[${user.name}](${conf.url}/@${user.username})さんと引き分けました~`
? `?[${getUserName(user)}](${conf.url}/@${user.username})さんと引き分けました~`
: msg.body.winnerId == id
? `?[${user.name}](${conf.url}/@${user.username})さんに勝ちました♪`
: `?[${user.name}](${conf.url}/@${user.username})さんに負けました...`;
? `?[${getUserName(user)}](${conf.url}/@${user.username})さんに勝ちました♪`
: `?[${getUserName(user)}](${conf.url}/@${user.username})さんに負けました...`;
await request.post(`${conf.api_url}/posts/create`, {
json: { i,

View File

@ -1,3 +1,4 @@
import getUserName from '../renderers/get-user-name';
import getPostSummary from './get-post-summary';
import getReactionEmoji from './get-reaction-emoji';
@ -8,19 +9,19 @@ import getReactionEmoji from './get-reaction-emoji';
export default function(notification: any): string {
switch (notification.type) {
case 'follow':
return `${notification.user.name}にフォローされました`;
return `${getUserName(notification.user)}にフォローされました`;
case 'mention':
return `言及されました:\n${notification.user.name}${getPostSummary(notification.post)}`;
return `言及されました:\n${getUserName(notification.user)}${getPostSummary(notification.post)}`;
case 'reply':
return `返信されました:\n${notification.user.name}${getPostSummary(notification.post)}`;
return `返信されました:\n${getUserName(notification.user)}${getPostSummary(notification.post)}`;
case 'repost':
return `Repostされました:\n${notification.user.name}${getPostSummary(notification.post)}`;
return `Repostされました:\n${getUserName(notification.user)}${getPostSummary(notification.post)}`;
case 'quote':
return `引用されました:\n${notification.user.name}${getPostSummary(notification.post)}`;
return `引用されました:\n${getUserName(notification.user)}${getPostSummary(notification.post)}`;
case 'reaction':
return `リアクションされました:\n${notification.user.name} <${getReactionEmoji(notification.reaction)}>「${getPostSummary(notification.post)}`;
return `リアクションされました:\n${getUserName(notification.user)} <${getReactionEmoji(notification.reaction)}>「${getPostSummary(notification.post)}`;
case 'poll_vote':
return `投票されました:\n${notification.user.name}${getPostSummary(notification.post)}`;
return `投票されました:\n${getUserName(notification.user)}${getPostSummary(notification.post)}`;
default:
return `<不明な通知タイプ: ${notification.type}>`;
}

View File

@ -1,12 +1,13 @@
import { IUser, isLocalUser } from '../models/user';
import getAcct from '../acct/render';
import getUserName from './get-user-name';
/**
*
* @param user
*/
export default function(user: IUser): string {
let string = `${user.name} (@${getAcct(user)})\n` +
let string = `${getUserName(user)} (@${getAcct(user)})\n` +
`${user.postsCount}投稿、${user.followingCount}フォロー、${user.followersCount}フォロワー\n`;
if (isLocalUser(user)) {

View File

@ -4,6 +4,7 @@ import * as bcrypt from 'bcryptjs';
import User, { IUser, init as initUser, ILocalUser } from '../../../models/user';
import getPostSummary from '../../../renderers/get-post-summary';
import getUserName from '../../../renderers/get-user-name';
import getUserSummary from '../../../renderers/get-user-summary';
import parseAcct from '../../../acct/parse';
import getNotificationSummary from '../../../renderers/get-notification-summary';
@ -90,7 +91,7 @@ export default class BotCore extends EventEmitter {
'タイムラインや通知を見た後、「次」というとさらに遡ることができます。';
case 'me':
return this.user ? `${this.user.name}としてサインインしています。\n\n${getUserSummary(this.user)}` : 'サインインしていません';
return this.user ? `${getUserName(this.user)}としてサインインしています。\n\n${getUserSummary(this.user)}` : 'サインインしていません';
case 'login':
case 'signin':
@ -230,7 +231,7 @@ class SigninContext extends Context {
if (same) {
this.bot.signin(this.temporaryUser);
this.bot.clearContext();
return `${this.temporaryUser.name}さん、おかえりなさい!`;
return `${getUserName(this.temporaryUser)}さん、おかえりなさい!`;
} else {
return `パスワードが違います... もう一度教えてください:`;
}
@ -305,7 +306,7 @@ class TlContext extends Context {
this.emit('updated');
const text = tl
.map(post => `${post.user.name}\n「${getPostSummary(post)}`)
.map(post => `${getUserName(post.user)}\n「${getPostSummary(post)}`)
.join('\n-----\n');
return text;

View File

@ -10,6 +10,7 @@ import prominence = require('prominence');
import getAcct from '../../../../acct/render';
import parseAcct from '../../../../acct/parse';
import getPostSummary from '../../../../renderers/get-post-summary';
import getUserName from '../../../../renderers/get-user-name';
const redis = prominence(_redis);
@ -131,7 +132,7 @@ class LineBot extends BotCore {
template: {
type: 'buttons',
thumbnailImageUrl: `${user.avatarUrl}?thumbnail&size=1024`,
title: `${user.name} (@${acct})`,
title: `${getUserName(user)} (@${acct})`,
text: user.description || '(no description)',
actions: actions
}
@ -146,7 +147,7 @@ class LineBot extends BotCore {
limit: 5
}, this.user);
const text = `${tl[0].user.name}さんのタイムラインはこちらです:\n\n` + tl
const text = `${getUserName(tl[0].user)}さんのタイムラインはこちらです:\n\n` + tl
.map(post => getPostSummary(post))
.join('\n-----\n');