Add user name conversions (#3534)

* Add user name conversions

* add conversion
This commit is contained in:
MeiMei 2018-12-07 11:29:49 +09:00 committed by syuilo
parent 1c722494de
commit 93b599dc8e
10 changed files with 17 additions and 17 deletions

View file

@ -15,7 +15,7 @@
</div> </div>
<div class="me"> <div class="me">
<img class="avatar" :src="$store.state.i.avatarUrl" alt="avatar"/> <img class="avatar" :src="$store.state.i.avatarUrl" alt="avatar"/>
<p class="name">{{ $store.state.i | userName }}</p> <p class="name"><mk-user-name :user="$store.state.i"/></p>
</div> </div>
<ul> <ul>
<li @click="nav('dashboard')" :class="{ active: page == 'dashboard' }"><fa icon="home" fixed-width/>{{ $t('dashboard') }}</li> <li @click="nav('dashboard')" :class="{ active: page == 'dashboard' }"><fa icon="home" fixed-width/>{{ $t('dashboard') }}</li>

View file

@ -46,7 +46,7 @@
</div> </div>
<div> <div>
<header> <header>
<b>{{ user | userName }}</b> <b><mk-user-name :user="user"/></b>
<span class="username">@{{ user | acct }}</span> <span class="username">@{{ user | acct }}</span>
</header> </header>
<div> <div>

View file

@ -1,7 +1,7 @@
<template> <template>
<div class="xqnhankfuuilcwvhgsopeqncafzsquya"> <div class="xqnhankfuuilcwvhgsopeqncafzsquya">
<button class="go-index" v-if="selfNav" @click="goIndex"><fa icon="arrow-left"/></button> <button class="go-index" v-if="selfNav" @click="goIndex"><fa icon="arrow-left"/></button>
<header><b><router-link :to="blackUser | userPage">{{ blackUser | userName }}</router-link></b>({{ $t('@.reversi.black') }}) vs <b><router-link :to="whiteUser | userPage">{{ whiteUser | userName }}</router-link></b>({{ $t('@.reversi.white') }})</header> <header><b><router-link :to="blackUser | userPage"><mk-user-name :user="blackUser"/></router-link></b>({{ $t('@.reversi.black') }}) vs <b><router-link :to="whiteUser | userPage"><mk-user-name :user="whiteUser"/></router-link></b>({{ $t('@.reversi.white') }})</header>
<div style="overflow: hidden; line-height: 28px;"> <div style="overflow: hidden; line-height: 28px;">
<p class="turn" v-if="!iAmPlayer && !game.isEnded">{{ $t('@.reversi.turn-of', { name: $options.filters.userName(turnUser) }) }}<mk-ellipsis/></p> <p class="turn" v-if="!iAmPlayer && !game.isEnded">{{ $t('@.reversi.turn-of', { name: $options.filters.userName(turnUser) }) }}<mk-ellipsis/></p>
@ -10,7 +10,7 @@
<p class="turn2" v-if="iAmPlayer && !game.isEnded && isMyTurn" v-animate-css="{ classes: 'tada', iteration: 'infinite' }">{{ $t('@.reversi.my-turn') }}</p> <p class="turn2" v-if="iAmPlayer && !game.isEnded && isMyTurn" v-animate-css="{ classes: 'tada', iteration: 'infinite' }">{{ $t('@.reversi.my-turn') }}</p>
<p class="result" v-if="game.isEnded && logPos == logs.length"> <p class="result" v-if="game.isEnded && logPos == logs.length">
<template v-if="game.winner"> <template v-if="game.winner">
<span>{{ $t('@.reversi.won', { name: $options.filters.userName(game.winner) }) }}</span> <misskey-flavored-markdown :text="$t('@.reversi.won', { name: $options.filters.userName(game.winner) })" :shouldBreak="false" :plainText="true" :custom-emojis="game.winner.emojis"/>
<span v-if="game.surrendered != null"> ({{ $t('surrendered') }})</span> <span v-if="game.surrendered != null"> ({{ $t('surrendered') }})</span>
</template> </template>
<template v-else>{{ $t('@.reversi.drawn') }}</template> <template v-else>{{ $t('@.reversi.drawn') }}</template>

View file

@ -19,7 +19,7 @@
<h2>{{ $t('invitations') }}</h2> <h2>{{ $t('invitations') }}</h2>
<div class="invitation" v-for="i in invitations" tabindex="-1" @click="accept(i)"> <div class="invitation" v-for="i in invitations" tabindex="-1" @click="accept(i)">
<mk-avatar class="avatar" :user="i.parent"/> <mk-avatar class="avatar" :user="i.parent"/>
<span class="name"><b>{{ i.parent | userName }}</b></span> <span class="name"><b><mk-user-name :user="i.parent"/></b></span>
<span class="username">@{{ i.parent.username }}</span> <span class="username">@{{ i.parent.username }}</span>
<mk-time :time="i.createdAt"/> <mk-time :time="i.createdAt"/>
</div> </div>
@ -29,7 +29,7 @@
<a class="game" v-for="g in myGames" tabindex="-1" @click.prevent="go(g)" :href="`/reversi/${g.id}`"> <a class="game" v-for="g in myGames" tabindex="-1" @click.prevent="go(g)" :href="`/reversi/${g.id}`">
<mk-avatar class="avatar" :user="g.user1"/> <mk-avatar class="avatar" :user="g.user1"/>
<mk-avatar class="avatar" :user="g.user2"/> <mk-avatar class="avatar" :user="g.user2"/>
<span><b>{{ g.user1 | userName }}</b> vs <b>{{ g.user2 | userName }}</b></span> <span><b><mk-user-name :user="g.user1"/></b> vs <b><mk-user-name :user="g.user2"/></b></span>
<span class="state">{{ g.isEnded ? $t('game-state.ended') : $t('game-state.playing') }}</span> <span class="state">{{ g.isEnded ? $t('game-state.ended') : $t('game-state.playing') }}</span>
<mk-time :time="g.createdAt" /> <mk-time :time="g.createdAt" />
</a> </a>
@ -39,7 +39,7 @@
<a class="game" v-for="g in games" tabindex="-1" @click.prevent="go(g)" :href="`/reversi/${g.id}`"> <a class="game" v-for="g in games" tabindex="-1" @click.prevent="go(g)" :href="`/reversi/${g.id}`">
<mk-avatar class="avatar" :user="g.user1"/> <mk-avatar class="avatar" :user="g.user1"/>
<mk-avatar class="avatar" :user="g.user2"/> <mk-avatar class="avatar" :user="g.user2"/>
<span><b>{{ g.user1 | userName }}</b> vs <b>{{ g.user2 | userName }}</b></span> <span><b><mk-user-name :user="g.user1"/></b> vs <b><mk-user-name :user="g.user2"/></b></span>
<span class="state">{{ g.isEnded ? $t('game-state.ended') : $t('game-state.playing') }}</span> <span class="state">{{ g.isEnded ? $t('game-state.ended') : $t('game-state.playing') }}</span>
<mk-time :time="g.createdAt" /> <mk-time :time="g.createdAt" />
</a> </a>

View file

@ -1,6 +1,6 @@
<template> <template>
<div class="urbixznjwwuukfsckrwzwsqzsxornqij"> <div class="urbixznjwwuukfsckrwzwsqzsxornqij">
<header><b>{{ game.user1 | userName }}</b> vs <b>{{ game.user2 | userName }}</b></header> <header><b><mk-user-name :user="game.user1"/></b> vs <b><mk-user-name :user="game.user2"/></b></header>
<div> <div>
<p>{{ $t('settings-of-the-game') }}</p> <p>{{ $t('settings-of-the-game') }}</p>
@ -36,8 +36,8 @@
<div> <div>
<form-radio v-model="game.settings.bw" value="random" @change="updateSettings">{{ $t('random') }}</form-radio> <form-radio v-model="game.settings.bw" value="random" @change="updateSettings">{{ $t('random') }}</form-radio>
<form-radio v-model="game.settings.bw" :value="1" @change="updateSettings">{{ this.$t('black-is').split('{}')[0] }}<b>{{ game.user1 | userName }}</b>{{ this.$t('black-is').split('{}')[1] }}</form-radio> <form-radio v-model="game.settings.bw" :value="1" @change="updateSettings">{{ this.$t('black-is').split('{}')[0] }}<b><mk-user-name :user="game.user1"/></b>{{ this.$t('black-is').split('{}')[1] }}</form-radio>
<form-radio v-model="game.settings.bw" :value="2" @change="updateSettings">{{ this.$t('black-is').split('{}')[0] }}<b>{{ game.user2 | userName }}</b>{{ this.$t('black-is').split('{}')[1] }}</form-radio> <form-radio v-model="game.settings.bw" :value="2" @change="updateSettings">{{ this.$t('black-is').split('{}')[0] }}<b><mk-user-name :user="game.user2"/></b>{{ this.$t('black-is').split('{}')[1] }}</form-radio>
</div> </div>
</div> </div>

View file

@ -4,7 +4,7 @@
<x-gameroom :game="game" :self-nav="selfNav" @go-index="goIndex"/> <x-gameroom :game="game" :self-nav="selfNav" @go-index="goIndex"/>
</div> </div>
<div class="matching" v-else-if="matching"> <div class="matching" v-else-if="matching">
<h1>{{ this.$t('matching.waiting-for').split('{}')[0] }}<b>{{ matching | userName }}</b>{{ this.$t('matching.waiting-for').split('{}')[1] }}<mk-ellipsis/></h1> <h1>{{ this.$t('matching.waiting-for').split('{}')[0] }}<b><mk-user-name :user="matching"/></b>{{ this.$t('matching.waiting-for').split('{}')[1] }}<mk-ellipsis/></h1>
<div class="cancel"> <div class="cancel">
<form-button round @click="cancel">{{ $t('matching.cancel') }}</form-button> <form-button round @click="cancel">{{ $t('matching.cancel') }}</form-button>
</div> </div>

View file

@ -14,7 +14,7 @@
tabindex="-1" tabindex="-1"
> >
<mk-avatar class="avatar" :user="user"/> <mk-avatar class="avatar" :user="user"/>
<span class="name">{{ user | userName }}</span> <span class="name"><mk-user-name :user="user"/></span>
<span class="username">@{{ user | acct }}</span> <span class="username">@{{ user | acct }}</span>
</li> </li>
</ol> </ol>
@ -33,7 +33,7 @@
<div> <div>
<mk-avatar class="avatar" :user="isMe(message) ? message.recipient : message.user"/> <mk-avatar class="avatar" :user="isMe(message) ? message.recipient : message.user"/>
<header> <header>
<span class="name">{{ isMe(message) ? message.recipient : message.user | userName }}</span> <span class="name"><mk-user-name :user="isMe(message) ? message.recipient : message.user"/></span>
<span class="username">@{{ isMe(message) ? message.recipient : message.user | acct }}</span> <span class="username">@{{ isMe(message) ? message.recipient : message.user | acct }}</span>
<mk-time :time="message.createdAt"/> <mk-time :time="message.createdAt"/>
</header> </header>

View file

@ -7,7 +7,7 @@
<ui-info v-if="!muteFetching && mute.length == 0">{{ $t('no-muted-users') }}</ui-info> <ui-info v-if="!muteFetching && mute.length == 0">{{ $t('no-muted-users') }}</ui-info>
<div class="users" v-if="mute.length != 0"> <div class="users" v-if="mute.length != 0">
<div v-for="user in mute" :key="user.id"> <div v-for="user in mute" :key="user.id">
<p><b>{{ user | userName }}</b> @{{ user | acct }}</p> <p><b><mk-user-name :user="user"/></b> @{{ user | acct }}</p>
</div> </div>
</div> </div>
</section> </section>
@ -17,7 +17,7 @@
<ui-info v-if="!blockFetching && block.length == 0">{{ $t('no-blocked-users') }}</ui-info> <ui-info v-if="!blockFetching && block.length == 0">{{ $t('no-blocked-users') }}</ui-info>
<div class="users" v-if="block.length != 0"> <div class="users" v-if="block.length != 0">
<div v-for="user in block" :key="user.id"> <div v-for="user in block" :key="user.id">
<p><b>{{ user | userName }}</b> @{{ user | acct }}</p> <p><b><mk-user-name :user="user"/></b> @{{ user | acct }}</p>
</div> </div>
</div> </div>
</section> </section>

View file

@ -1,6 +1,6 @@
<template> <template>
<mk-window ref="window" width="500px" height="560px" :popout-url="popout" @closed="destroyDom"> <mk-window ref="window" width="500px" height="560px" :popout-url="popout" @closed="destroyDom">
<span slot="header" :class="$style.header"><fa icon="comments"/>{{ $t('title') }} {{ user | userName }}</span> <span slot="header" :class="$style.header"><fa icon="comments"/>{{ $t('title') }} <mk-user-name :user="user"/></span>
<x-messaging-room :user="user" :class="$style.content"/> <x-messaging-room :user="user" :class="$style.content"/>
</mk-window> </mk-window>
</template> </template>

View file

@ -1,7 +1,7 @@
<template> <template>
<mk-ui> <mk-ui>
<span slot="header"> <span slot="header">
<template v-if="user"><span style="margin-right:4px;"><fa :icon="['far', 'comments']"/></span>{{ user | userName }}</template> <template v-if="user"><span style="margin-right:4px;"><fa :icon="['far', 'comments']"/></span><mk-user-name :user="user"/></template>
<template v-else><mk-ellipsis/></template> <template v-else><mk-ellipsis/></template>
</span> </span>
<x-messaging-room v-if="!fetching" :user="user" :is-naked="true"/> <x-messaging-room v-if="!fetching" :user="user" :is-naked="true"/>