Merge pull request #70 from ThinaticSystem/Thinatic/feature-renote-impressions-digger

feat: RN先の言及を見るボタン
This commit is contained in:
しなちくシステム 2022-06-11 19:46:55 +09:00 committed by GitHub
commit 76dfeec604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,6 +61,7 @@
<Mfm :text="getNoteSummary(notification.note)" :plain="true" :nowrap="!full" :custom-emojis="notification.note.emojis"/>
<i class="fas fa-quote-right"></i>
</MkA>
<button v-if="notification.type === 'renote'" class="_textButton" @click="openRenoteDestination(notification)">RN先を覗く👀</button>
<span v-if="notification.type === 'follow'" class="text" style="opacity: 0.6;">{{ $ts.youGotNewFollower }}<div v-if="full"><MkFollowButton :user="notification.user" :full="true"/></div></span>
<span v-if="notification.type === 'followRequestAccepted'" class="text" style="opacity: 0.6;">{{ $ts.followRequestAccepted }}</span>
<span v-if="notification.type === 'receiveFollowRequest'" class="text" style="opacity: 0.6;">{{ $ts.receiveFollowRequest }}<div v-if="full && !followRequestDone"><button class="_textButton" @click="acceptFollowRequest()">{{ $ts.accept }}</button> | <button class="_textButton" @click="rejectFollowRequest()">{{ $ts.reject }}</button></div></span>
@ -170,8 +171,24 @@ export default defineComponent({
}, {}, 'closed');
});
function openRenoteDestination(renoteNotification: misskey.entities.Notification): void {
if (renoteNotification.type !== 'renote') {
throw new Error("openRenoteDestination()の引数には type: 'renote' のNotificationが渡される必要があります");
}
os.api('users/show', {userId: renoteNotification.user.id}).then((user: misskey.entities.UserDetailed) => {
if (user.host != null && user.followersCount === 0) { // 稿
if (user.url === null) { throw new Error('User page URL is Null') };
window.open(user.url, '_blank', 'rel="nofollow noopener"');
} else {
os.pageWindow(notePage(renoteNotification.note));
}
});
}
return {
getNoteSummary: (note: misskey.entities.Note) => getNoteSummary(note),
openRenoteDestination: (renoteNotification: misskey.entities.Notification) => openRenoteDestination(renoteNotification),
followRequestDone,
groupInviteDone,
notePage,