Merge pull request #1407 from akihikodaki/name

This commit is contained in:
syuilo 2018-04-06 01:41:50 +09:00 committed by GitHub
commit ebacbc4c30
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
53 changed files with 312 additions and 109 deletions

View file

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

View file

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

View file

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

View file

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

View file

@ -6,7 +6,7 @@
</router-link> </router-link>
<div class="body"> <div class="body">
<header> <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> <span class="username">@{{ getAcct(post.user) }}</span>
<div class="info"> <div class="info">
<router-link class="created-at" :to="`/@${getAcct(post.user)}/${post.id}`"> <router-link class="created-at" :to="`/@${getAcct(post.user)}/${post.id}`">
@ -25,6 +25,7 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import getAcct from '../../../../../acct/render'; import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({ export default Vue.extend({
data() { data() {
@ -38,6 +39,7 @@ export default Vue.extend({
}, },
methods: { methods: {
getAcct, getAcct,
getUserName,
fetch(cb?) { fetch(cb?) {
this.fetching = true; this.fetching = true;
(this as any).api('posts', { (this as any).api('posts', {

View file

@ -1,7 +1,7 @@
<template> <template>
<mk-window width="400px" height="550px" @closed="$destroy"> <mk-window width="400px" height="550px" @closed="$destroy">
<span slot="header" :class="$style.header"> <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> </span>
<mk-followers :user="user"/> <mk-followers :user="user"/>
</mk-window> </mk-window>
@ -9,8 +9,15 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({ export default Vue.extend({
props: ['user'] props: ['user'],
computed {
name() {
return getUserName(this.user);
}
}
}); });
</script> </script>

View file

@ -1,7 +1,7 @@
<template> <template>
<mk-window width="400px" height="550px" @closed="$destroy"> <mk-window width="400px" height="550px" @closed="$destroy">
<span slot="header" :class="$style.header"> <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> </span>
<mk-following :user="user"/> <mk-following :user="user"/>
</mk-window> </mk-window>
@ -9,8 +9,15 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({ export default Vue.extend({
props: ['user'] props: ['user'],
computed: {
name() {
return getUserName(this.user);
}
}
}); });
</script> </script>

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -4,7 +4,7 @@
<div class="main" ref="main"> <div class="main" ref="main">
<div class="backdrop"></div> <div class="backdrop"></div>
<div class="main"> <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="container" ref="mainContainer">
<div class="left"> <div class="left">
<x-nav/> <x-nav/>
@ -33,7 +33,14 @@ import XNotifications from './ui.header.notifications.vue';
import XPost from './ui.header.post.vue'; import XPost from './ui.header.post.vue';
import XClock from './ui.header.clock.vue'; import XClock from './ui.header.clock.vue';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({ export default Vue.extend({
computed: {
name() {
return getUserName(this.os.i);
}
},
components: { components: {
XNav, XNav,
XSearch, XSearch,

View file

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

View file

@ -8,6 +8,7 @@
import Vue from 'vue'; import Vue from 'vue';
import Progress from '../../../common/scripts/loading'; import Progress from '../../../common/scripts/loading';
import parseAcct from '../../../../../acct/parse'; import parseAcct from '../../../../../acct/parse';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({ export default Vue.extend({
data() { data() {
@ -34,7 +35,7 @@ export default Vue.extend({
this.user = user; this.user = user;
this.fetching = false; this.fetching = false;
document.title = 'メッセージ: ' + this.user.name; document.title = 'メッセージ: ' + getUserName(this.user);
Progress.done(); 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> <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"> <div v-if="!fetching && users.length > 0">
<router-link v-for="user in users" :to="`/@${getAcct(user)}`" :key="user.id"> <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> </router-link>
</div> </div>
<p class="empty" v-if="!fetching && users.length == 0">%i18n:desktop.tags.mk-user.followers-you-know.no-users%</p> <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"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import getAcct from '../../../../../../acct/render'; import getAcct from '../../../../../../acct/render';
import getUserName from '../../../../../../renderers/get-user-name';
export default Vue.extend({ export default Vue.extend({
props: ['user'], props: ['user'],
@ -24,7 +25,8 @@ export default Vue.extend({
}; };
}, },
method() { method() {
getAcct getAcct,
getUserName
}, },
mounted() { mounted() {
(this as any).api('users/followers', { (this as any).api('users/followers', {

View file

@ -7,7 +7,7 @@
<div class="container"> <div class="container">
<img class="avatar" :src="`${user.avatarUrl}?thumbnail&size=150`" alt="avatar"/> <img class="avatar" :src="`${user.avatarUrl}?thumbnail&size=150`" alt="avatar"/>
<div class="title"> <div class="title">
<p class="name">{{ user.name }}</p> <p class="name">{{ name }}</p>
<p class="username">@{{ acct }}</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> <p class="location" v-if="user.host === null && user.account.profile.location">%fa:map-marker%{{ user.account.profile.location }}</p>
</div> </div>
@ -23,12 +23,16 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import getAcct from '../../../../../../acct/render'; import getAcct from '../../../../../../acct/render';
import getUserName from '../../../../../../renderers/get-user-name';
export default Vue.extend({ export default Vue.extend({
props: ['user'], props: ['user'],
computed: { computed: {
acct() { acct() {
return getAcct(this.user); return getAcct(this.user);
},
name() {
return getUserName(this.user);
} }
}, },
mounted() { mounted() {

View file

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

View file

@ -2,7 +2,7 @@
<div class="post"> <div class="post">
<header> <header>
<a class="index" @click="reply">{{ post.index }}:</a> <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> <span>ID:<i>{{ acct }}</i></span>
</header> </header>
<div> <div>
@ -20,12 +20,16 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import getAcct from '../../../../../acct/render'; import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({ export default Vue.extend({
props: ['post'], props: ['post'],
computed: { computed: {
acct() { acct() {
return getAcct(this.post.user); return getAcct(this.post.user);
},
name() {
return getUserName(this.post.user);
} }
}, },
methods: { methods: {

View file

@ -15,19 +15,26 @@
title="クリックでアバター編集" title="クリックでアバター編集"
v-user-preview="os.i.id" 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> <p class="username">@{{ os.i.username }}</p>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import define from '../../../common/define-widget'; import define from '../../../common/define-widget';
import getUserName from '../../../../../renderers/get-user-name';
export default define({ export default define({
name: 'profile', name: 'profile',
props: () => ({ props: () => ({
design: 0 design: 0
}) })
}).extend({ }).extend({
computed: {
name() {
return getUserName(this.os.i);
}
},
methods: { methods: {
func() { func() {
if (this.props.design == 2) { 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"/> <img class="avatar" :src="`${_user.avatarUrl}?thumbnail&size=42`" alt="" v-user-preview="_user.id"/>
</router-link> </router-link>
<div class="body"> <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> <p class="username">@{{ getAcct(_user) }}</p>
</div> </div>
<mk-follow-button :user="_user"/> <mk-follow-button :user="_user"/>
@ -24,6 +24,7 @@
<script lang="ts"> <script lang="ts">
import define from '../../../common/define-widget'; import define from '../../../common/define-widget';
import getAcct from '../../../../../acct/render'; import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
const limit = 3; const limit = 3;
@ -45,6 +46,7 @@ export default define({
}, },
methods: { methods: {
getAcct, getAcct,
getUserName,
func() { func() {
this.props.compact = !this.props.compact; this.props.compact = !this.props.compact;
}, },

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -5,7 +5,7 @@
</router-link> </router-link>
<div class="main"> <div class="main">
<header> <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> <span class="username">@{{ acct }}</span>
<router-link class="created-at" :to="`/@${acct}/${post.id}`"> <router-link class="created-at" :to="`/@${acct}/${post.id}`">
<mk-time :time="post.createdAt"/> <mk-time :time="post.createdAt"/>
@ -21,12 +21,16 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import getAcct from '../../../../../acct/render'; import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({ export default Vue.extend({
props: ['post'], props: ['post'],
computed: { computed: {
acct() { acct() {
return getAcct(this.post.user); return getAcct(this.post.user);
},
name() {
return getUserName(this.post.user);
} }
} }
}); });

View file

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

View file

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

View file

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

View file

@ -5,7 +5,7 @@
<img :src="`${user.avatarUrl}?thumbnail&size=200`" alt="avatar"/> <img :src="`${user.avatarUrl}?thumbnail&size=200`" alt="avatar"/>
</a> </a>
</header> </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> <p class="username">@{{ acct }}</p>
<mk-follow-button :user="user"/> <mk-follow-button :user="user"/>
</div> </div>
@ -14,12 +14,16 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import getAcct from '../../../../../acct/render'; import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({ export default Vue.extend({
props: ['user'], props: ['user'],
computed: { computed: {
acct() { acct() {
return getAcct(this.user); return getAcct(this.user);
},
name() {
return getUserName(this.user);
} }
} }
}); });

View file

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

View file

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

View file

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

View file

@ -1,7 +1,7 @@
<template> <template>
<mk-ui> <mk-ui>
<span slot="header"> <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> <template v-else><mk-ellipsis/></template>
</span> </span>
<mk-messaging-room v-if="!fetching" :user="user" :is-naked="true"/> <mk-messaging-room v-if="!fetching" :user="user" :is-naked="true"/>
@ -11,6 +11,7 @@
<script lang="ts"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import parseAcct from '../../../../../acct/parse'; import parseAcct from '../../../../../acct/parse';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({ export default Vue.extend({
data() { data() {
@ -19,6 +20,11 @@ export default Vue.extend({
user: null user: null
}; };
}, },
computed: {
name() {
return getUserName(this.user);
}
},
watch: { watch: {
$route: 'fetch' $route: 'fetch'
}, },
@ -33,7 +39,7 @@ export default Vue.extend({
this.user = user; this.user = user;
this.fetching = false; 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() { 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.location = (this as any).os.i.account.profile.location;
this.description = (this as any).os.i.description; this.description = (this as any).os.i.description;
this.birthday = (this as any).os.i.account.profile.birthday; this.birthday = (this as any).os.i.account.profile.birthday;
@ -94,7 +94,7 @@ export default Vue.extend({
this.saving = true; this.saving = true;
(this as any).api('i/update', { (this as any).api('i/update', {
name: this.name, name: this.name || null,
location: this.location || null, location: this.location || null,
description: this.description || null, description: this.description || null,
birthday: this.birthday || null birthday: this.birthday || null

View file

@ -2,7 +2,7 @@
<mk-ui> <mk-ui>
<span slot="header">%fa:cog%%i18n:mobile.tags.mk-settings-page.settings%</span> <span slot="header">%fa:cog%%i18n:mobile.tags.mk-settings-page.settings%</span>
<div :class="$style.content"> <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> <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/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> <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"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import { version, codename } from '../../../config'; import { version, codename } from '../../../config';
import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({ export default Vue.extend({
data() { data() {
@ -28,6 +29,11 @@ export default Vue.extend({
codename codename
}; };
}, },
computed: {
name() {
return getUserName(this.os.i);
}
},
mounted() { mounted() {
document.title = 'Misskey | %i18n:mobile.tags.mk-settings-page.settings%'; document.title = 'Misskey | %i18n:mobile.tags.mk-settings-page.settings%';
document.documentElement.style.background = '#313a42'; document.documentElement.style.background = '#313a42';

View file

@ -1,6 +1,6 @@
<template> <template>
<mk-ui> <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"> <main v-if="!fetching">
<header> <header>
<div class="banner" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl}?thumbnail&size=1024)` : ''"></div> <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"/> <mk-follow-button v-if="os.isSignedIn && os.i.id != user.id" :user="user"/>
</div> </div>
<div class="title"> <div class="title">
<h1>{{ user.name }}</h1> <h1>{{ user }}</h1>
<span class="username">@{{ acct }}</span> <span class="username">@{{ acct }}</span>
<span class="followed" v-if="user.isFollowed">%i18n:mobile.tags.mk-user.follows-you%</span> <span class="followed" v-if="user.isFollowed">%i18n:mobile.tags.mk-user.follows-you%</span>
</div> </div>
@ -61,7 +61,7 @@
import Vue from 'vue'; import Vue from 'vue';
import * as age from 's-age'; import * as age from 's-age';
import getAcct from '../../../../../acct/render'; import getAcct from '../../../../../acct/render';
import getAcct from '../../../../../acct/parse'; import getUserName from '../../../../../renderers/get-user-name';
import Progress from '../../../common/scripts/loading'; import Progress from '../../../common/scripts/loading';
import XHome from './user/home.vue'; import XHome from './user/home.vue';
@ -82,6 +82,9 @@ export default Vue.extend({
}, },
age(): number { age(): number {
return age(this.user.account.profile.birthday); return age(this.user.account.profile.birthday);
},
name() {
return getUserName(this.user);
} }
}, },
watch: { watch: {
@ -102,7 +105,7 @@ export default Vue.extend({
this.fetching = false; this.fetching = false;
Progress.done(); 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> <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"> <div v-if="!fetching && users.length > 0">
<a v-for="user in users" :key="user.id" :href="`/@${getAcct(user)}`"> <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> </a>
</div> </div>
<p class="empty" v-if="!fetching && users.length == 0">%i18n:mobile.tags.mk-user-overview-followers-you-know.no-users%</p> <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"> <script lang="ts">
import Vue from 'vue'; import Vue from 'vue';
import getAcct from '../../../../../../acct/render'; import getAcct from '../../../../../../acct/render';
import getUserName from '../../../../../../renderers/get-user-name';
export default Vue.extend({ export default Vue.extend({
props: ['user'], props: ['user'],
@ -22,6 +23,11 @@ export default Vue.extend({
users: [] users: []
}; };
}, },
computed: {
name() {
return getUserName(this.user);
}
},
methods: { methods: {
getAcct getAcct
}, },

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -47,7 +47,6 @@ export default async (req: express.Request, res: express.Response) => {
const username = req.body['username']; const username = req.body['username'];
const password = req.body['password']; const password = req.body['password'];
const name = '名無し';
// Validate username // Validate username
if (!validateUsername(username)) { if (!validateUsername(username)) {
@ -113,7 +112,7 @@ export default async (req: express.Request, res: express.Response) => {
description: null, description: null,
followersCount: 0, followersCount: 0,
followingCount: 0, followingCount: 0,
name: name, name: null,
postsCount: 0, postsCount: 0,
driveCapacity: 1024 * 1024 * 128, // 128MiB driveCapacity: 1024 * 1024 * 128, // 128MiB
username: username, username: username,