Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
syuilo committed Apr 15, 2021
2 parents 449dc17 + 526838c commit 5e1d17d
Show file tree
Hide file tree
Showing 19 changed files with 229 additions and 170 deletions.
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,8 @@ unlikeConfirm: "いいね解除しますか?"
fullView: "フルビュー"
quitFullView: "フルビュー解除"
addDescription: "説明を追加"
userPagePinTip: "個々のノートのメニューから「ピン留め」を選択することで、ここにノートを表示しておくことができます。"
notSpecifiedMentionWarning: "宛先に含まれていないメンションがあります"

_email:
_follow:
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "misskey",
"author": "syuilo <syuilotan@yahoo.co.jp>",
"version": "12.76.0",
"version": "12.76.1",
"codename": "indigo",
"repository": {
"type": "git",
Expand Down Expand Up @@ -181,7 +181,7 @@
"markdown-it": "12.0.4",
"markdown-it-anchor": "7.1.0",
"matter-js": "0.16.1",
"mfm-js": "0.14.0",
"mfm-js": "0.15.0",
"mocha": "8.3.2",
"moji": "0.5.1",
"ms": "2.1.3",
Expand Down
14 changes: 8 additions & 6 deletions src/client/components/date-separated-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,23 @@ export default defineComponent({
methods: {
focus() {
this.$slots.default[0].elm.focus();
}
},
},
render() {
const getDateText = (time: string) => {
getDateText(time: string) {
const date = new Date(time).getDate();
const month = new Date(time).getMonth() + 1;
return this.$t('monthAndDay', {
month: month.toString(),
day: date.toString()
});
}
},
render() {
const noGap = [...document.querySelectorAll('._noGap_')].some(el => el.contains(this.$parent.$el));
if (this.items.length === 0) return;
return h(this.$store.state.animation ? TransitionGroup : 'div', this.$store.state.animation ? {
class: 'sqadhkmv' + (noGap ? ' _block' : ''),
name: 'list',
Expand Down Expand Up @@ -72,10 +74,10 @@ export default defineComponent({
class: 'icon',
icon: faAngleUp,
}),
getDateText(item.createdAt)
this.getDateText(item.createdAt)
]),
h('span', [
getDateText(this.items[i + 1].createdAt),
this.getDateText(this.items[i + 1].createdAt),
h(FontAwesomeIcon, {
class: 'icon',
icon: faAngleDown,
Expand Down
11 changes: 7 additions & 4 deletions src/client/components/mfm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ export default defineComponent({
const text = token.props.text.replace(/(\r\n|\n|\r)/g, '\n');

if (!this.plain) {
const x = text.split('\n')
.map(t => t == '' ? [h('br')] : [t, h('br')]);
x[x.length - 1].pop();
return x;
const res = [];
for (const t of text.split('\n')) {
res.push(h('br'));
res.push(t);
}
res.shift();
return res;
} else {
return [text.replace(/\n/g, ' ')];
}
Expand Down
5 changes: 2 additions & 3 deletions src/client/components/notifications.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<template>
<div class="mfcuwfyp _noGap_">
<div class="_magnet"></div>
<XList class="notifications" :items="items" v-slot="{ item: notification }">
<div class="mfcuwfyp _noGap_ _magnetParent">
<XList class="notifications _magnetChild" :items="items" v-slot="{ item: notification }">
<XNote v-if="['reply', 'quote', 'mention'].includes(notification.type)" :note="notification.note" @update:note="noteUpdated(notification.note, $event)" :key="notification.id"/>
<XNotification v-else :notification="notification" :with-time="true" :full="true" class="_panel notification" :key="notification.id"/>
</XList>
Expand Down
48 changes: 47 additions & 1 deletion src/client/components/post-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<button @click="addVisibleUser" class="_buttonPrimary"><Fa :icon="faPlus" fixed-width/></button>
</div>
</div>
<MkInfo warn v-if="hasNotSpecifiedMentions" class="hasNotSpecifiedMentions">{{ $ts.notSpecifiedMentionWarning }} - <button class="_textButton" @click="addMissingMention()">{{ $ts.add }}</button></MkInfo>
<input v-show="useCw" ref="cw" class="cw" v-model="cw" :placeholder="$ts.annotation" @keydown="onKeydown">
<textarea v-model="text" class="text" :class="{ withCw: useCw }" ref="text" :disabled="posting" :placeholder="placeholder" @keydown="onKeydown" @paste="onPaste" @compositionupdate="onCompositionUpdate" @compositionend="onCompositionEnd" />
<XPostFormAttaches class="attaches" :files="files" @updated="updateFiles" @detach="detachFile" @changeSensitive="updateFileSensitive" @changeName="updateFileName"/>
Expand Down Expand Up @@ -71,12 +72,14 @@ import { selectFile } from '@client/scripts/select-file';
import { notePostInterruptors, postFormActions } from '@client/store';
import { isMobile } from '@client/scripts/is-mobile';
import { throttle } from 'throttle-debounce';
import MkInfo from '@client/components/ui/info.vue';
export default defineComponent({
components: {
XNotePreview,
XPostFormAttaches: defineAsyncComponent(() => import('./post-form-attaches.vue')),
XPollEditor: defineAsyncComponent(() => import('./poll-editor.vue'))
XPollEditor: defineAsyncComponent(() => import('./poll-editor.vue')),
MkInfo,
},
inject: ['modal'],
Expand Down Expand Up @@ -143,6 +146,7 @@ export default defineComponent({
autocomplete: null,
draghover: false,
quoteId: null,
hasNotSpecifiedMentions: false,
recentHashtags: JSON.parse(localStorage.getItem('hashtags') || '[]'),
imeText: '',
typing: throttle(3000, () => {
Expand Down Expand Up @@ -214,6 +218,18 @@ export default defineComponent({
}
},
watch: {
text() {
this.checkMissingMention();
},
visibleUsers: {
handler() {
this.checkMissingMention();
},
deep: true
}
},
mounted() {
if (this.initialText) {
this.text = this.initialText;
Expand Down Expand Up @@ -338,6 +354,32 @@ export default defineComponent({
this.$watch('localOnly', () => this.saveDraft());
},
checkMissingMention() {
if (this.visibility === 'specified') {
const ast = mfm.parse(this.text);
for (const x of extractMentions(ast)) {
if (!this.visibleUsers.some(u => (u.username === x.username) && (u.host == x.host))) {
this.hasNotSpecifiedMentions = true;
return;
}
}
this.hasNotSpecifiedMentions = false;
}
},
addMissingMention() {
const ast = mfm.parse(this.text);
for (const x of extractMentions(ast)) {
if (!this.visibleUsers.some(u => (u.username === x.username) && (u.host == x.host))) {
os.api('users/show', { username: x.username, host: x.host }).then(user => {
this.visibleUsers.push(user);
});
}
}
},
togglePoll() {
if (this.poll) {
this.poll = null;
Expand Down Expand Up @@ -741,6 +783,10 @@ export default defineComponent({
}
}
> .hasNotSpecifiedMentions {
margin: 0 20px 16px 20px;
}
> .cw,
> .text {
display: block;
Expand Down
7 changes: 7 additions & 0 deletions src/client/pages/messaging/messaging-room.message.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ export default defineComponent({
display: flex;
> .avatar {
position: sticky;
top: calc(var(--stickyTop, 0px) + 16px);
display: block;
width: 54px;
height: 54px;
Expand Down Expand Up @@ -274,6 +276,11 @@ export default defineComponent({
background: $me-balloon-color;
text-align: left;
::selection {
color: var(--accent);
background-color: #fff;
}
&.noText {
background: transparent;
}
Expand Down
Loading

0 comments on commit 5e1d17d

Please sign in to comment.