Merge branch 'develop' into swn

This commit is contained in:
tamaina 2021-11-11 23:00:32 +09:00
commit e8288268e0
8 changed files with 492 additions and 397 deletions

View File

@ -15,6 +15,7 @@
### Improvements ### Improvements
- フォロー/フォロワーを非公開にできるように - フォロー/フォロワーを非公開にできるように
- インスタンスプロフィールレンダリング ready - インスタンスプロフィールレンダリング ready
- 通知のリアクションアイコンをホバーで拡大できるように
- メールアドレスのバリデーションを強化 - メールアドレスのバリデーションを強化
### Bugfixes ### Bugfixes

View File

@ -73,7 +73,7 @@
"@types/koa__router": "8.0.8", "@types/koa__router": "8.0.8",
"@types/matter-js": "0.17.6", "@types/matter-js": "0.17.6",
"@types/mocha": "8.2.3", "@types/mocha": "8.2.3",
"@types/node": "16.11.4", "@types/node": "16.11.7",
"@types/node-fetch": "2.5.12", "@types/node-fetch": "2.5.12",
"@types/nodemailer": "6.4.4", "@types/nodemailer": "6.4.4",
"@types/nprogress": "0.2.0", "@types/nprogress": "0.2.0",
@ -91,7 +91,7 @@
"@types/request-stats": "3.0.0", "@types/request-stats": "3.0.0",
"@types/rimraf": "3.0.2", "@types/rimraf": "3.0.2",
"@types/seedrandom": "2.4.28", "@types/seedrandom": "2.4.28",
"@types/sharp": "0.29.2", "@types/sharp": "0.29.3",
"@types/sinonjs__fake-timers": "6.0.4", "@types/sinonjs__fake-timers": "6.0.4",
"@types/speakeasy": "2.0.6", "@types/speakeasy": "2.0.6",
"@types/throttle-debounce": "2.1.0", "@types/throttle-debounce": "2.1.0",
@ -104,7 +104,7 @@
"@types/websocket": "1.0.4", "@types/websocket": "1.0.4",
"@types/ws": "8.2.0", "@types/ws": "8.2.0",
"@typescript-eslint/parser": "5.1.0", "@typescript-eslint/parser": "5.1.0",
"@vue/compiler-sfc": "3.2.20", "@vue/compiler-sfc": "3.2.21",
"abort-controller": "3.0.0", "abort-controller": "3.0.0",
"autobind-decorator": "2.4.0", "autobind-decorator": "2.4.0",
"autosize": "4.0.4", "autosize": "4.0.4",
@ -112,11 +112,11 @@
"aws-sdk": "2.1013.0", "aws-sdk": "2.1013.0",
"bcryptjs": "2.4.3", "bcryptjs": "2.4.3",
"blurhash": "1.1.4", "blurhash": "1.1.4",
"broadcast-channel": "4.2.0", "broadcast-channel": "4.5.0",
"bull": "3.29.3", "bull": "4.1.0",
"cacheable-lookup": "6.0.3", "cacheable-lookup": "6.0.4",
"cafy": "15.2.1", "cafy": "15.2.1",
"cbor": "8.0.2", "cbor": "8.1.0",
"chalk": "4.1.2", "chalk": "4.1.2",
"chart.js": "3.6.0", "chart.js": "3.6.0",
"chartjs-adapter-date-fns": "2.0.0", "chartjs-adapter-date-fns": "2.0.0",
@ -126,14 +126,14 @@
"concurrently": "6.3.0", "concurrently": "6.3.0",
"content-disposition": "0.5.3", "content-disposition": "0.5.3",
"crc-32": "1.2.0", "crc-32": "1.2.0",
"css-loader": "6.4.0", "css-loader": "6.5.1",
"cssnano": "5.0.8", "cssnano": "5.0.10",
"date-fns": "2.25.0", "date-fns": "2.25.0",
"dateformat": "4.5.1", "dateformat": "4.5.1",
"deep-email-validator": "0.1.18", "deep-email-validator": "0.1.18",
"escape-regexp": "0.0.1", "escape-regexp": "0.0.1",
"eslint": "8.1.0", "eslint": "8.2.0",
"eslint-plugin-vue": "7.20.0", "eslint-plugin-vue": "8.0.3",
"eventemitter3": "4.0.7", "eventemitter3": "4.0.7",
"feed": "4.2.2", "feed": "4.2.2",
"file-type": "16.5.3", "file-type": "16.5.3",
@ -167,7 +167,7 @@
"koa-mount": "4.0.0", "koa-mount": "4.0.0",
"koa-send": "5.0.1", "koa-send": "5.0.1",
"koa-slow": "2.1.0", "koa-slow": "2.1.0",
"koa-views": "7.0.1", "koa-views": "7.0.2",
"langmap": "0.0.16", "langmap": "0.0.16",
"matter-js": "0.17.1", "matter-js": "0.17.1",
"mfm-js": "0.20.0", "mfm-js": "0.20.0",
@ -186,7 +186,7 @@
"postcss": "8.3.11", "postcss": "8.3.11",
"postcss-loader": "6.2.0", "postcss-loader": "6.2.0",
"prismjs": "1.25.0", "prismjs": "1.25.0",
"private-ip": "2.3.0", "private-ip": "2.3.3",
"probe-image-size": "7.2.1", "probe-image-size": "7.2.1",
"promise-limit": "2.7.0", "promise-limit": "2.7.0",
"pug": "3.0.2", "pug": "3.0.2",
@ -205,8 +205,8 @@
"rimraf": "3.0.2", "rimraf": "3.0.2",
"rndstr": "1.0.0", "rndstr": "1.0.0",
"s-age": "1.1.2", "s-age": "1.1.2",
"sass": "1.43.3", "sass": "1.43.4",
"sass-loader": "12.2.0", "sass-loader": "12.3.0",
"seedrandom": "3.0.5", "seedrandom": "3.0.5",
"sharp": "0.29.2", "sharp": "0.29.2",
"speakeasy": "2.0.0", "speakeasy": "2.0.0",
@ -215,7 +215,7 @@
"style-loader": "3.3.1", "style-loader": "3.3.1",
"summaly": "2.4.1", "summaly": "2.4.1",
"syslog-pro": "1.0.0", "syslog-pro": "1.0.0",
"systeminformation": "5.9.8", "systeminformation": "5.9.9",
"syuilo-password-strength": "0.0.1", "syuilo-password-strength": "0.0.1",
"textarea-caret": "3.1.0", "textarea-caret": "3.1.0",
"three": "0.117.1", "three": "0.117.1",
@ -229,13 +229,13 @@
"tslint": "6.1.3", "tslint": "6.1.3",
"tslint-sonarts": "1.9.0", "tslint-sonarts": "1.9.0",
"twemoji-parser": "13.1.0", "twemoji-parser": "13.1.0",
"typeorm": "0.2.38", "typeorm": "0.2.39",
"typescript": "4.4.4", "typescript": "4.4.4",
"ulid": "2.3.0", "ulid": "2.3.0",
"uuid": "8.3.2", "uuid": "8.3.2",
"v-debounce": "0.1.2", "v-debounce": "0.1.2",
"vanilla-tilt": "1.7.2", "vanilla-tilt": "1.7.2",
"vue": "3.2.20", "vue": "3.2.21",
"vue-loader": "16.7.0", "vue-loader": "16.7.0",
"vue-prism-editor": "2.0.0-alpha.2", "vue-prism-editor": "2.0.0-alpha.2",
"vue-router": "4.0.5", "vue-router": "4.0.5",
@ -243,7 +243,7 @@
"vue-svg-loader": "0.17.0-beta.2", "vue-svg-loader": "0.17.0-beta.2",
"vuedraggable": "4.0.1", "vuedraggable": "4.0.1",
"web-push": "3.4.5", "web-push": "3.4.5",
"webpack": "5.59.1", "webpack": "5.63.0",
"webpack-cli": "4.9.1", "webpack-cli": "4.9.1",
"websocket": "1.0.34", "websocket": "1.0.34",
"ws": "8.2.3", "ws": "8.2.3",

View File

@ -1,5 +1,5 @@
<template> <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"> <div class="head">
<MkAvatar v-if="notification.user" class="icon" :user="notification.user"/> <MkAvatar v-if="notification.user" class="icon" :user="notification.user"/>
<img v-else-if="notification.icon" class="icon" :src="notification.icon" alt=""/> <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 === 'quote'" class="fas fa-quote-left"></i>
<i v-else-if="notification.type === 'pollVote'" class="fas fa-poll-h"></i> <i v-else-if="notification.type === 'pollVote'" class="fas fa-poll-h"></i>
<!-- notification.reaction null になることはまずないがここでoptional chaining使うと一部ブラウザで刺さるので念の為 --> <!-- 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> </div>
<div class="tail"> <div class="tail">
@ -59,10 +68,11 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { defineComponent, markRaw } from 'vue'; import { defineComponent, ref, onMounted, onUnmounted, watch } from 'vue';
import { getNoteSummary } from '@/misc/get-note-summary'; import { getNoteSummary } from '@/misc/get-note-summary';
import XReactionIcon from './reaction-icon.vue'; import XReactionIcon from './reaction-icon.vue';
import MkFollowButton from './follow-button.vue'; import MkFollowButton from './follow-button.vue';
import XReactionTooltip from './reaction-tooltip.vue';
import notePage from '@client/filters/note'; import notePage from '@client/filters/note';
import { userPage } from '@client/filters/user'; import { userPage } from '@client/filters/user';
import { i18n } from '@client/i18n'; import { i18n } from '@client/i18n';
@ -72,6 +82,7 @@ export default defineComponent({
components: { components: {
XReactionIcon, MkFollowButton XReactionIcon, MkFollowButton
}, },
props: { props: {
notification: { notification: {
type: Object, type: Object,
@ -88,65 +99,121 @@ export default defineComponent({
default: false, default: false,
}, },
}, },
data() {
return {
getNoteSummary: (text: string) => getNoteSummary(text, i18n.locale),
followRequestDone: false,
groupInviteDone: false,
readObserver: null as IntersectionObserver | null,
};
},
watch: { setup(props) {
'notification.isRead'() { const elRef = ref<HTMLElement>(null);
this.readObserver?.unobserve(this.$el); const reactionRef = ref(null);
this.readObserver = null;
},
},
mounted() { onMounted(() => {
if (!this.notification.isRead) { let readObserver: IntersectionObserver = null;
this.readObserver = new IntersectionObserver((entries, observer) => { let connection = null;
if (!props.notification.isRead) {
readObserver = new IntersectionObserver((entries, observer) => {
if (!entries.some(entry => entry.isIntersecting)) return; if (!entries.some(entry => entry.isIntersecting)) return;
os.stream.send('readNotification', { os.stream.send('readNotification', {
id: this.notification.id id: props.notification.id
}); });
for (const { target } of entries) { entries.map(({ target }) => observer.unobserve(target));
observer.unobserve(target);
}
this.readObserver = null;
}); });
this.readObserver.observe(this.$el); readObserver.observe(elRef.value);
}
},
beforeUnmount() { connection = os.stream.useChannel('main');
if (!this.notification.isRead) { connection.on('readAllNotifications', () => readObserver.unobserve(elRef.value));
this.readObserver?.unobserve(this.$el);
}
},
methods: { watch(props.notification.isRead, () => {
acceptFollowRequest() { readObserver?.unobserve(elRef.value);
this.followRequestDone = true; });
os.api('following/requests/accept', { userId: this.notification.user.id }); }
},
rejectFollowRequest() { onUnmounted(() => {
this.followRequestDone = true; if (readObserver) readObserver.unobserve(elRef.value);
os.api('following/requests/reject', { userId: this.notification.user.id }); if (connection) connection.dispose();
}, });
acceptGroupInvitation() { });
this.groupInviteDone = true;
os.apiWithDialog('users/groups/invitations/accept', { invitationId: this.notification.invitation.id }); const followRequestDone = ref(false);
}, const groupInviteDone = ref(false);
rejectGroupInvitation() {
this.groupInviteDone = true; const acceptFollowRequest = () => {
os.api('users/groups/invitations/reject', { invitationId: this.notification.invitation.id }); 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,
groupInviteDone,
notePage, notePage,
userPage userPage,
} acceptFollowRequest,
rejectFollowRequest,
acceptGroupInvitation,
rejectGroupInvitation,
onReactionMouseover,
onReactionMouseleave,
elRef,
reactionRef,
};
},
}); });
</script> </script>
@ -203,7 +270,7 @@ export default defineComponent({
background: var(--panel); background: var(--panel);
box-shadow: 0 0 0 3px var(--panel); box-shadow: 0 0 0 3px var(--panel);
font-size: 12px; font-size: 12px;
pointer-events: none; text-align: center;
&:empty { &:empty {
display: none; display: none;
@ -218,31 +285,37 @@ export default defineComponent({
&.follow, &.followRequestAccepted, &.receiveFollowRequest, &.groupInvited { &.follow, &.followRequestAccepted, &.receiveFollowRequest, &.groupInvited {
padding: 3px; padding: 3px;
background: #36aed2; background: #36aed2;
pointer-events: none;
} }
&.renote { &.renote {
padding: 3px; padding: 3px;
background: #36d298; background: #36d298;
pointer-events: none;
} }
&.quote { &.quote {
padding: 3px; padding: 3px;
background: #36d298; background: #36d298;
pointer-events: none;
} }
&.reply { &.reply {
padding: 3px; padding: 3px;
background: #007aff; background: #007aff;
pointer-events: none;
} }
&.mention { &.mention {
padding: 3px; padding: 3px;
background: #88a6b7; background: #88a6b7;
pointer-events: none;
} }
&.pollVote { &.pollVote {
padding: 3px; padding: 3px;
background: #88a6b7; background: #88a6b7;
pointer-events: none;
} }
} }
} }

View File

@ -869,7 +869,7 @@ export default defineComponent({
color: var(--fg); color: var(--fg);
font-family: inherit; font-family: inherit;
&:focus-visible { &:focus {
outline: none; outline: none;
} }

View File

@ -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>

View File

@ -480,7 +480,7 @@ hr {
padding: 5px; padding: 5px;
} }
.prism-editor__textarea:focus-visible { .prism-editor__textarea:focus {
outline: none; outline: none;
} }

View File

@ -678,7 +678,7 @@ export default defineComponent({
color: var(--fg); color: var(--fg);
font-family: inherit; font-family: inherit;
&:focus-visible { &:focus {
outline: none; outline: none;
} }

602
yarn.lock

File diff suppressed because it is too large Load Diff