This commit is contained in:
syuilo 2018-04-08 19:27:53 +09:00
parent 282f685065
commit 2076ab876a
3 changed files with 33 additions and 52 deletions

View File

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

View File

@ -2,15 +2,15 @@
<div class="mk-notification">
<div class="notification reaction" v-if="notification.type == 'reaction'">
<mk-time :time="notification.createdAt"/>
<router-link class="avatar-anchor" :to="`/@${acct}`">
<router-link class="avatar-anchor" :to="`/@${getAcct(notification.user)}`">
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
</router-link>
<div class="text">
<p>
<mk-reaction-icon :reaction="notification.reaction"/>
<router-link :to="`/@${acct}`">{{ getUserName(notification.user) }}</router-link>
<router-link :to="`/@${getAcct(notification.user)}`">{{ getUserName(notification.user) }}</router-link>
</p>
<router-link class="note-ref" :to="`/@${acct}/${notification.note.id}`">
<router-link class="note-ref" :to="`/@${getAcct(notification.note.user)}/${notification.note.id}`">
%fa:quote-left%{{ getNoteSummary(notification.note) }}
%fa:quote-right%
</router-link>
@ -19,15 +19,15 @@
<div class="notification renote" v-if="notification.type == 'renote'">
<mk-time :time="notification.createdAt"/>
<router-link class="avatar-anchor" :to="`/@${acct}`">
<img class="avatar" :src="`${notification.note.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
<router-link class="avatar-anchor" :to="`/@${getAcct(notification.user)}`">
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
</router-link>
<div class="text">
<p>
%fa:retweet%
<router-link :to="`/@${acct}`">{{ getUserName(notification.note.user) }}</router-link>
<router-link :to="`/@${getAcct(notification.user)}`">{{ getUserName(notification.user) }}</router-link>
</p>
<router-link class="note-ref" :to="`/@${acct}/${notification.note.id}`">
<router-link class="note-ref" :to="`/@${getAcct(notification.note.user)}/${notification.note.id}`">
%fa:quote-left%{{ getNoteSummary(notification.note.renote) }}%fa:quote-right%
</router-link>
</div>
@ -39,13 +39,13 @@
<div class="notification follow" v-if="notification.type == 'follow'">
<mk-time :time="notification.createdAt"/>
<router-link class="avatar-anchor" :to="`/@${acct}`">
<router-link class="avatar-anchor" :to="`/@${getAcct(notification.user)}`">
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
</router-link>
<div class="text">
<p>
%fa:user-plus%
<router-link :to="`/@${acct}`">{{ getUserName(notification.user) }}</router-link>
<router-link :to="`/@${getAcct(notification.user)}`">{{ getUserName(notification.user) }}</router-link>
</p>
</div>
</div>
@ -60,15 +60,15 @@
<div class="notification poll_vote" v-if="notification.type == 'poll_vote'">
<mk-time :time="notification.createdAt"/>
<router-link class="avatar-anchor" :to="`/@${acct}`">
<router-link class="avatar-anchor" :to="`/@${getAcct(notification.user)}`">
<img class="avatar" :src="`${notification.user.avatarUrl}?thumbnail&size=64`" alt="avatar"/>
</router-link>
<div class="text">
<p>
%fa:chart-pie%
<router-link :to="`/@${acct}`">{{ getUserName(notification.user) }}</router-link>
<router-link :to="`/@${getAcct(notification.user)}`">{{ getUserName(notification.user) }}</router-link>
</p>
<router-link class="note-ref" :to="`/@${acct}/${notification.note.id}`">
<router-link class="note-ref" :to="`/@${getAcct(notification.note.user)}/${notification.note.id}`">
%fa:quote-left%{{ getNoteSummary(notification.note) }}%fa:quote-right%
</router-link>
</div>
@ -84,20 +84,11 @@ import getUserName from '../../../../../renderers/get-user-name';
export default Vue.extend({
props: ['notification'],
computed: {
acct() {
return getAcct(this.notification.user);
},
name() {
return getUserName(this.notification.user);
},
noteerName() {
return getUserName(this.notification.note.user);
}
},
data() {
return {
getNoteSummary
getNoteSummary,
getAcct,
getUserName
};
}
});

View File

@ -12,8 +12,8 @@
<mk-follow-button v-if="os.isSignedIn && os.i.id != user.id" :user="user"/>
</div>
<div class="title">
<h1>{{ user }}</h1>
<span class="username">@{{ acct }}</span>
<h1>{{ getUserName(user) }}</h1>
<span class="username">@{{ getAcct(user) }}</span>
<span class="followed" v-if="user.isFollowed">%i18n:mobile.tags.mk-user.follows-you%</span>
</div>
<div class="description">{{ user.description }}</div>
@ -30,11 +30,11 @@
<b>{{ user.notesCount | number }}</b>
<i>%i18n:mobile.tags.mk-user.notes%</i>
</a>
<a :href="`@${acct}/following`">
<a :href="`@${getAcct(user)}/following`">
<b>{{ user.followingCount | number }}</b>
<i>%i18n:mobile.tags.mk-user.following%</i>
</a>
<a :href="`@${acct}/followers`">
<a :href="`@${getAcct(user)}/followers`">
<b>{{ user.followersCount | number }}</b>
<i>%i18n:mobile.tags.mk-user.followers%</i>
</a>
@ -60,6 +60,7 @@
<script lang="ts">
import Vue from 'vue';
import * as age from 's-age';
import parseAcct from '../../../../../acct/parse';
import getAcct from '../../../../../acct/render';
import getUserName from '../../../../../renderers/get-user-name';
import Progress from '../../../common/scripts/loading';
@ -73,18 +74,14 @@ export default Vue.extend({
return {
fetching: true,
user: null,
page: 'home'
page: 'home',
getAcct,
getUserName
};
},
computed: {
acct() {
return this.getAcct(this.user);
},
age(): number {
return age(this.user.profile.birthday);
},
name() {
return getUserName(this.user);
}
},
watch: {
@ -105,7 +102,7 @@ export default Vue.extend({
this.fetching = false;
Progress.done();
document.title = this.name + ' | Misskey';
document.title = this.getUserName(this.user) + ' | Misskey';
});
}
}