Merge branch 'develop' into swn
This commit is contained in:
commit
e8288268e0
|
@ -15,6 +15,7 @@
|
|||
### Improvements
|
||||
- フォロー/フォロワーを非公開にできるように
|
||||
- インスタンスプロフィールレンダリング ready
|
||||
- 通知のリアクションアイコンをホバーで拡大できるように
|
||||
- メールアドレスのバリデーションを強化
|
||||
|
||||
### Bugfixes
|
||||
|
|
38
package.json
38
package.json
|
@ -73,7 +73,7 @@
|
|||
"@types/koa__router": "8.0.8",
|
||||
"@types/matter-js": "0.17.6",
|
||||
"@types/mocha": "8.2.3",
|
||||
"@types/node": "16.11.4",
|
||||
"@types/node": "16.11.7",
|
||||
"@types/node-fetch": "2.5.12",
|
||||
"@types/nodemailer": "6.4.4",
|
||||
"@types/nprogress": "0.2.0",
|
||||
|
@ -91,7 +91,7 @@
|
|||
"@types/request-stats": "3.0.0",
|
||||
"@types/rimraf": "3.0.2",
|
||||
"@types/seedrandom": "2.4.28",
|
||||
"@types/sharp": "0.29.2",
|
||||
"@types/sharp": "0.29.3",
|
||||
"@types/sinonjs__fake-timers": "6.0.4",
|
||||
"@types/speakeasy": "2.0.6",
|
||||
"@types/throttle-debounce": "2.1.0",
|
||||
|
@ -104,7 +104,7 @@
|
|||
"@types/websocket": "1.0.4",
|
||||
"@types/ws": "8.2.0",
|
||||
"@typescript-eslint/parser": "5.1.0",
|
||||
"@vue/compiler-sfc": "3.2.20",
|
||||
"@vue/compiler-sfc": "3.2.21",
|
||||
"abort-controller": "3.0.0",
|
||||
"autobind-decorator": "2.4.0",
|
||||
"autosize": "4.0.4",
|
||||
|
@ -112,11 +112,11 @@
|
|||
"aws-sdk": "2.1013.0",
|
||||
"bcryptjs": "2.4.3",
|
||||
"blurhash": "1.1.4",
|
||||
"broadcast-channel": "4.2.0",
|
||||
"bull": "3.29.3",
|
||||
"cacheable-lookup": "6.0.3",
|
||||
"broadcast-channel": "4.5.0",
|
||||
"bull": "4.1.0",
|
||||
"cacheable-lookup": "6.0.4",
|
||||
"cafy": "15.2.1",
|
||||
"cbor": "8.0.2",
|
||||
"cbor": "8.1.0",
|
||||
"chalk": "4.1.2",
|
||||
"chart.js": "3.6.0",
|
||||
"chartjs-adapter-date-fns": "2.0.0",
|
||||
|
@ -126,14 +126,14 @@
|
|||
"concurrently": "6.3.0",
|
||||
"content-disposition": "0.5.3",
|
||||
"crc-32": "1.2.0",
|
||||
"css-loader": "6.4.0",
|
||||
"cssnano": "5.0.8",
|
||||
"css-loader": "6.5.1",
|
||||
"cssnano": "5.0.10",
|
||||
"date-fns": "2.25.0",
|
||||
"dateformat": "4.5.1",
|
||||
"deep-email-validator": "0.1.18",
|
||||
"escape-regexp": "0.0.1",
|
||||
"eslint": "8.1.0",
|
||||
"eslint-plugin-vue": "7.20.0",
|
||||
"eslint": "8.2.0",
|
||||
"eslint-plugin-vue": "8.0.3",
|
||||
"eventemitter3": "4.0.7",
|
||||
"feed": "4.2.2",
|
||||
"file-type": "16.5.3",
|
||||
|
@ -167,7 +167,7 @@
|
|||
"koa-mount": "4.0.0",
|
||||
"koa-send": "5.0.1",
|
||||
"koa-slow": "2.1.0",
|
||||
"koa-views": "7.0.1",
|
||||
"koa-views": "7.0.2",
|
||||
"langmap": "0.0.16",
|
||||
"matter-js": "0.17.1",
|
||||
"mfm-js": "0.20.0",
|
||||
|
@ -186,7 +186,7 @@
|
|||
"postcss": "8.3.11",
|
||||
"postcss-loader": "6.2.0",
|
||||
"prismjs": "1.25.0",
|
||||
"private-ip": "2.3.0",
|
||||
"private-ip": "2.3.3",
|
||||
"probe-image-size": "7.2.1",
|
||||
"promise-limit": "2.7.0",
|
||||
"pug": "3.0.2",
|
||||
|
@ -205,8 +205,8 @@
|
|||
"rimraf": "3.0.2",
|
||||
"rndstr": "1.0.0",
|
||||
"s-age": "1.1.2",
|
||||
"sass": "1.43.3",
|
||||
"sass-loader": "12.2.0",
|
||||
"sass": "1.43.4",
|
||||
"sass-loader": "12.3.0",
|
||||
"seedrandom": "3.0.5",
|
||||
"sharp": "0.29.2",
|
||||
"speakeasy": "2.0.0",
|
||||
|
@ -215,7 +215,7 @@
|
|||
"style-loader": "3.3.1",
|
||||
"summaly": "2.4.1",
|
||||
"syslog-pro": "1.0.0",
|
||||
"systeminformation": "5.9.8",
|
||||
"systeminformation": "5.9.9",
|
||||
"syuilo-password-strength": "0.0.1",
|
||||
"textarea-caret": "3.1.0",
|
||||
"three": "0.117.1",
|
||||
|
@ -229,13 +229,13 @@
|
|||
"tslint": "6.1.3",
|
||||
"tslint-sonarts": "1.9.0",
|
||||
"twemoji-parser": "13.1.0",
|
||||
"typeorm": "0.2.38",
|
||||
"typeorm": "0.2.39",
|
||||
"typescript": "4.4.4",
|
||||
"ulid": "2.3.0",
|
||||
"uuid": "8.3.2",
|
||||
"v-debounce": "0.1.2",
|
||||
"vanilla-tilt": "1.7.2",
|
||||
"vue": "3.2.20",
|
||||
"vue": "3.2.21",
|
||||
"vue-loader": "16.7.0",
|
||||
"vue-prism-editor": "2.0.0-alpha.2",
|
||||
"vue-router": "4.0.5",
|
||||
|
@ -243,7 +243,7 @@
|
|||
"vue-svg-loader": "0.17.0-beta.2",
|
||||
"vuedraggable": "4.0.1",
|
||||
"web-push": "3.4.5",
|
||||
"webpack": "5.59.1",
|
||||
"webpack": "5.63.0",
|
||||
"webpack-cli": "4.9.1",
|
||||
"websocket": "1.0.34",
|
||||
"ws": "8.2.3",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<div class="qglefbjs" :class="notification.type" v-size="{ max: [500, 600] }">
|
||||
<div class="qglefbjs" :class="notification.type" v-size="{ max: [500, 600] }" ref="elRef">
|
||||
<div class="head">
|
||||
<MkAvatar v-if="notification.user" class="icon" :user="notification.user"/>
|
||||
<img v-else-if="notification.icon" class="icon" :src="notification.icon" alt=""/>
|
||||
|
@ -14,7 +14,16 @@
|
|||
<i v-else-if="notification.type === 'quote'" class="fas fa-quote-left"></i>
|
||||
<i v-else-if="notification.type === 'pollVote'" class="fas fa-poll-h"></i>
|
||||
<!-- notification.reaction が null になることはまずないが、ここでoptional chaining使うと一部ブラウザで刺さるので念の為 -->
|
||||
<XReactionIcon v-else-if="notification.type === 'reaction'" :reaction="notification.reaction ? notification.reaction.replace(/^:(\w+):$/, ':$1@.:') : notification.reaction" :custom-emojis="notification.note.emojis" :no-style="true"/>
|
||||
<XReactionIcon v-else-if="notification.type === 'reaction'"
|
||||
:reaction="notification.reaction ? notification.reaction.replace(/^:(\w+):$/, ':$1@.:') : notification.reaction"
|
||||
:custom-emojis="notification.note.emojis"
|
||||
:no-style="true"
|
||||
@touchstart.passive="onReactionMouseover"
|
||||
@mouseover="onReactionMouseover"
|
||||
@mouseleave="onReactionMouseleave"
|
||||
@touchend="onReactionMouseleave"
|
||||
ref="reactionRef"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tail">
|
||||
|
@ -59,10 +68,11 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, markRaw } from 'vue';
|
||||
import { defineComponent, ref, onMounted, onUnmounted, watch } from 'vue';
|
||||
import { getNoteSummary } from '@/misc/get-note-summary';
|
||||
import XReactionIcon from './reaction-icon.vue';
|
||||
import MkFollowButton from './follow-button.vue';
|
||||
import XReactionTooltip from './reaction-tooltip.vue';
|
||||
import notePage from '@client/filters/note';
|
||||
import { userPage } from '@client/filters/user';
|
||||
import { i18n } from '@client/i18n';
|
||||
|
@ -72,6 +82,7 @@ export default defineComponent({
|
|||
components: {
|
||||
XReactionIcon, MkFollowButton
|
||||
},
|
||||
|
||||
props: {
|
||||
notification: {
|
||||
type: Object,
|
||||
|
@ -88,65 +99,121 @@ export default defineComponent({
|
|||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
|
||||
setup(props) {
|
||||
const elRef = ref<HTMLElement>(null);
|
||||
const reactionRef = ref(null);
|
||||
|
||||
onMounted(() => {
|
||||
let readObserver: IntersectionObserver = null;
|
||||
let connection = null;
|
||||
|
||||
if (!props.notification.isRead) {
|
||||
readObserver = new IntersectionObserver((entries, observer) => {
|
||||
if (!entries.some(entry => entry.isIntersecting)) return;
|
||||
os.stream.send('readNotification', {
|
||||
id: props.notification.id
|
||||
});
|
||||
entries.map(({ target }) => observer.unobserve(target));
|
||||
});
|
||||
|
||||
readObserver.observe(elRef.value);
|
||||
|
||||
connection = os.stream.useChannel('main');
|
||||
connection.on('readAllNotifications', () => readObserver.unobserve(elRef.value));
|
||||
|
||||
watch(props.notification.isRead, () => {
|
||||
readObserver?.unobserve(elRef.value);
|
||||
});
|
||||
}
|
||||
|
||||
onUnmounted(() => {
|
||||
if (readObserver) readObserver.unobserve(elRef.value);
|
||||
if (connection) connection.dispose();
|
||||
});
|
||||
});
|
||||
|
||||
const followRequestDone = ref(false);
|
||||
const groupInviteDone = ref(false);
|
||||
|
||||
const acceptFollowRequest = () => {
|
||||
followRequestDone.value = true;
|
||||
os.api('following/requests/accept', { userId: props.notification.user.id });
|
||||
};
|
||||
|
||||
const rejectFollowRequest = () => {
|
||||
followRequestDone.value = true;
|
||||
os.api('following/requests/reject', { userId: props.notification.user.id });
|
||||
};
|
||||
|
||||
const acceptGroupInvitation = () => {
|
||||
groupInviteDone.value = true;
|
||||
os.apiWithDialog('users/groups/invitations/accept', { invitationId: props.notification.invitation.id });
|
||||
};
|
||||
|
||||
const rejectGroupInvitation = () => {
|
||||
groupInviteDone.value = true;
|
||||
os.api('users/groups/invitations/reject', { invitationId: props.notification.invitation.id });
|
||||
};
|
||||
|
||||
let isReactionHovering = false;
|
||||
let reactionTooltipTimeoutId;
|
||||
|
||||
const onReactionMouseover = () => {
|
||||
if (isReactionHovering) return;
|
||||
isReactionHovering = true;
|
||||
reactionTooltipTimeoutId = setTimeout(openReactionTooltip, 300);
|
||||
};
|
||||
|
||||
const onReactionMouseleave = () => {
|
||||
if (!isReactionHovering) return;
|
||||
isReactionHovering = false;
|
||||
clearTimeout(reactionTooltipTimeoutId);
|
||||
closeReactionTooltip();
|
||||
};
|
||||
|
||||
let changeReactionTooltipShowingState: () => void;
|
||||
|
||||
const openReactionTooltip = () => {
|
||||
closeReactionTooltip();
|
||||
if (!isReactionHovering) return;
|
||||
|
||||
const showing = ref(true);
|
||||
os.popup(XReactionTooltip, {
|
||||
showing,
|
||||
reaction: props.notification.reaction ? props.notification.reaction.replace(/^:(\w+):$/, ':$1@.:') : props.notification.reaction,
|
||||
emojis: props.notification.note.emojis,
|
||||
source: reactionRef.value.$el,
|
||||
}, {}, 'closed');
|
||||
|
||||
changeReactionTooltipShowingState = () => {
|
||||
showing.value = false;
|
||||
};
|
||||
};
|
||||
|
||||
const closeReactionTooltip = () => {
|
||||
if (changeReactionTooltipShowingState != null) {
|
||||
changeReactionTooltipShowingState();
|
||||
changeReactionTooltipShowingState = null;
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
getNoteSummary: (text: string) => getNoteSummary(text, i18n.locale),
|
||||
followRequestDone: false,
|
||||
groupInviteDone: false,
|
||||
readObserver: null as IntersectionObserver | null,
|
||||
followRequestDone,
|
||||
groupInviteDone,
|
||||
notePage,
|
||||
userPage,
|
||||
acceptFollowRequest,
|
||||
rejectFollowRequest,
|
||||
acceptGroupInvitation,
|
||||
rejectGroupInvitation,
|
||||
onReactionMouseover,
|
||||
onReactionMouseleave,
|
||||
elRef,
|
||||
reactionRef,
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
'notification.isRead'() {
|
||||
this.readObserver?.unobserve(this.$el);
|
||||
this.readObserver = null;
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
if (!this.notification.isRead) {
|
||||
this.readObserver = new IntersectionObserver((entries, observer) => {
|
||||
if (!entries.some(entry => entry.isIntersecting)) return;
|
||||
os.stream.send('readNotification', {
|
||||
id: this.notification.id
|
||||
});
|
||||
for (const { target } of entries) {
|
||||
observer.unobserve(target);
|
||||
}
|
||||
this.readObserver = null;
|
||||
});
|
||||
|
||||
this.readObserver.observe(this.$el);
|
||||
}
|
||||
},
|
||||
|
||||
beforeUnmount() {
|
||||
if (!this.notification.isRead) {
|
||||
this.readObserver?.unobserve(this.$el);
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
acceptFollowRequest() {
|
||||
this.followRequestDone = true;
|
||||
os.api('following/requests/accept', { userId: this.notification.user.id });
|
||||
},
|
||||
rejectFollowRequest() {
|
||||
this.followRequestDone = true;
|
||||
os.api('following/requests/reject', { userId: this.notification.user.id });
|
||||
},
|
||||
acceptGroupInvitation() {
|
||||
this.groupInviteDone = true;
|
||||
os.apiWithDialog('users/groups/invitations/accept', { invitationId: this.notification.invitation.id });
|
||||
},
|
||||
rejectGroupInvitation() {
|
||||
this.groupInviteDone = true;
|
||||
os.api('users/groups/invitations/reject', { invitationId: this.notification.invitation.id });
|
||||
},
|
||||
notePage,
|
||||
userPage
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
|
@ -203,7 +270,7 @@ export default defineComponent({
|
|||
background: var(--panel);
|
||||
box-shadow: 0 0 0 3px var(--panel);
|
||||
font-size: 12px;
|
||||
pointer-events: none;
|
||||
text-align: center;
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
|
@ -218,31 +285,37 @@ export default defineComponent({
|
|||
&.follow, &.followRequestAccepted, &.receiveFollowRequest, &.groupInvited {
|
||||
padding: 3px;
|
||||
background: #36aed2;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&.renote {
|
||||
padding: 3px;
|
||||
background: #36d298;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&.quote {
|
||||
padding: 3px;
|
||||
background: #36d298;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&.reply {
|
||||
padding: 3px;
|
||||
background: #007aff;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&.mention {
|
||||
padding: 3px;
|
||||
background: #88a6b7;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&.pollVote {
|
||||
padding: 3px;
|
||||
background: #88a6b7;
|
||||
pointer-events: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -869,7 +869,7 @@ export default defineComponent({
|
|||
color: var(--fg);
|
||||
font-family: inherit;
|
||||
|
||||
&:focus-visible {
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
<template>
|
||||
<MkTooltip :source="source" ref="tooltip" @closed="$emit('closed')" :max-width="340">
|
||||
<div class="beeadbfb">
|
||||
<XReactionIcon :reaction="reaction" :custom-emojis="emojis" class="icon" :no-style="true"/>
|
||||
<div class="name">{{ reaction.replace('@.', '') }}</div>
|
||||
</div>
|
||||
</MkTooltip>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import MkTooltip from './ui/tooltip.vue';
|
||||
import XReactionIcon from './reaction-icon.vue';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
MkTooltip,
|
||||
XReactionIcon,
|
||||
},
|
||||
props: {
|
||||
reaction: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
emojis: {
|
||||
type: Array,
|
||||
required: true,
|
||||
},
|
||||
source: {
|
||||
required: true,
|
||||
}
|
||||
},
|
||||
emits: ['closed'],
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.beeadbfb {
|
||||
text-align: center;
|
||||
|
||||
> .icon {
|
||||
display: block;
|
||||
width: 60px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
> .name {
|
||||
font-size: 0.9em;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -480,7 +480,7 @@ hr {
|
|||
padding: 5px;
|
||||
}
|
||||
|
||||
.prism-editor__textarea:focus-visible {
|
||||
.prism-editor__textarea:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -678,7 +678,7 @@ export default defineComponent({
|
|||
color: var(--fg);
|
||||
font-family: inherit;
|
||||
|
||||
&:focus-visible {
|
||||
&:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue