Merge remote-branch 'misskey/develop'

This commit is contained in:
NoriDev 2023-11-24 13:31:26 +09:00
commit 24b1b52b3b
35 changed files with 283 additions and 197 deletions

View file

@ -8,7 +8,7 @@
"version": "8.9.2" "version": "8.9.2"
}, },
"ghcr.io/devcontainers/features/node:1": { "ghcr.io/devcontainers/features/node:1": {
"version": "20.5.1" "version": "20.10.0"
} }
}, },
"forwardPorts": [3000], "forwardPorts": [3000],

View file

@ -6,37 +6,33 @@ on:
branches: branches:
- master - master
- develop - develop
paths:
- packages/backend/**
- .github/workflows/get-api-diff.yml
jobs: jobs:
get-base: get-from-cherrypick:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: read contents: read
strategy: strategy:
matrix: matrix:
node-version: [20.5.1] node-version: [20.10.0]
api-json-name: [api-base.json, api-head.json]
services: include:
db: - api-json-name: api-base.json
image: postgres:13 repo-name: ${{ github.event.pull_request.base.repo.full_name }}
ports: ref: ${{ github.base_ref }}
- 5432:5432 - api-json-name: api-head.json
env: repo-name: ${{ github.event.pull_request.head.repo.full_name }}
POSTGRES_DB: cherrypick ref: ${{ github.head_ref }}
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_USER: example-cherrypick-user
POSTGRESS_PASS: example-cherrypick-pass
redis:
image: redis:7
ports:
- 6379:6379
steps: steps:
- uses: actions/checkout@v4.1.1 - uses: actions/checkout@v4.1.1
with: with:
repository: ${{ github.event.pull_request.base.repo.full_name }} repository: ${{ matrix.repo-name }}
ref: ${{ github.base_ref }} ref: ${{ matrix.ref }}
submodules: true submodules: true
- name: Install pnpm - name: Install pnpm
uses: pnpm/action-setup@v2 uses: pnpm/action-setup@v2
@ -56,121 +52,15 @@ jobs:
run: cp .config/example.yml .config/default.yml run: cp .config/example.yml .config/default.yml
- name: Build - name: Build
run: pnpm build run: pnpm build
- name : Migrate - name: Generate API JSON
run: pnpm migrate run: pnpm --filter backend generate-api-json
- name: Launch cherrypick - name: Copy API.json
run: | run: cp packages/backend/built/api.json ${{ matrix.api-json-name }}
screen -S cherrypick -dm pnpm run dev
sleep 30s
- name: Wait for CherryPick to be ready
run: |
MAX_RETRIES=12
RETRY_DELAY=5
count=0
until $(curl --output /dev/null --silent --head --fail http://localhost:3000) || [[ $count -eq $MAX_RETRIES ]]; do
printf '.'
sleep $RETRY_DELAY
count=$((count + 1))
done
if [[ $count -eq $MAX_RETRIES ]]; then
echo "Failed to connect to CherryPick after $MAX_RETRIES attempts."
exit 1
fi
- id: fetch
name: Get api.json from CherryPick
run: |
RESULT=$(curl --retry 5 --retry-delay 5 --retry-max-time 60 http://localhost:3000/api.json)
echo $RESULT > api-base.json
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: api-artifact name: api-artifact
path: api-base.json path: ${{ matrix.api-json-name }}
- name: Kill CherryPick Job
run: screen -S cherrypick -X quit
get-head:
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
node-version: [20.5.1]
services:
db:
image: postgres:13
ports:
- 5432:5432
env:
POSTGRES_DB: cherrypick
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_USER: example-cherrypick-user
POSTGRESS_PASS: example-cherrypick-pass
redis:
image: redis:7
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4.1.1
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
submodules: true
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4.0.0
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: corepack enable
- run: pnpm i --frozen-lockfile
- name: Check pnpm-lock.yaml
run: git diff --exit-code pnpm-lock.yaml
- name: Copy Configure
run: cp .config/example.yml .config/default.yml
- name: Build
run: pnpm build
- name : Migrate
run: pnpm migrate
- name: Launch cherrypick
run: |
screen -S cherrypick -dm pnpm run dev
sleep 30s
- name: Wait for CherryPick to be ready
run: |
MAX_RETRIES=12
RETRY_DELAY=5
count=0
until $(curl --output /dev/null --silent --head --fail http://localhost:3000) || [[ $count -eq $MAX_RETRIES ]]; do
printf '.'
sleep $RETRY_DELAY
count=$((count + 1))
done
if [[ $count -eq $MAX_RETRIES ]]; then
echo "Failed to connect to CherryPick after $MAX_RETRIES attempts."
exit 1
fi
- id: fetch
name: Get api.json from CherryPick
run: |
RESULT=$(curl --retry 5 --retry-delay 5 --retry-max-time 60 http://localhost:3000/api.json)
echo $RESULT > api-head.json
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: api-artifact
path: api-head.json
- name: Kill CherryPick Job
run: screen -S cherrypick -X quit
save-pr-number: save-pr-number:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View file

@ -13,7 +13,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [20.5.1] node-version: [20.10.0]
services: services:
postgres: postgres:

View file

@ -16,7 +16,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [20.5.1] node-version: [20.10.0]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps: steps:

View file

@ -13,7 +13,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [20.5.1] node-version: [20.10.0]
steps: steps:
- uses: actions/checkout@v4.1.1 - uses: actions/checkout@v4.1.1
@ -51,7 +51,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
node-version: [20.5.1] node-version: [20.10.0]
browser: [chrome] browser: [chrome]
services: services:

View file

@ -16,7 +16,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [20.5.1] node-version: [20.10.0]
steps: steps:
- uses: actions/checkout@v4.1.1 - uses: actions/checkout@v4.1.1

View file

@ -1 +1 @@
20.5.1 20.10.0

View file

@ -17,16 +17,21 @@
### General ### General
- Feat: メールアドレスの認証にverifymail.ioを使えるように (cherry-pick from https://github.com/TeamNijimiss/misskey/commit/971ba07a44550f68d2ba31c62066db2d43a0caed) - Feat: メールアドレスの認証にverifymail.ioを使えるように (cherry-pick from https://github.com/TeamNijimiss/misskey/commit/971ba07a44550f68d2ba31c62066db2d43a0caed)
- Feat: モデレーターがユーザーのアイコンもしくはバナー画像を未設定状態にできる機能を追加 (cherry-pick from https://github.com/TeamNijimiss/misskey/commit/e0eb5a752f6e5616d6312bb7c9790302f9dbff83) - Feat: モデレーターがユーザーのアイコンもしくはバナー画像を未設定状態にできる機能を追加 (cherry-pick from https://github.com/TeamNijimiss/misskey/commit/e0eb5a752f6e5616d6312bb7c9790302f9dbff83)
- Fix: MFM `$[unixtime ]` に不正な値を入力した際に発生する各種エラーを修正
### Client ### Client
- Enhance: 絵文字のオートコンプリート機能強化 #12364 - Enhance: 絵文字のオートコンプリート機能強化 #12364
- fix: 「設定のバックアップ」で一部の項目がバックアップに含まれていなかった問題を修正 - fix: 「設定のバックアップ」で一部の項目がバックアップに含まれていなかった問題を修正
- Fix: ウィジェットのジョブキューにて音声の発音方法変更に追従できていなかったのを修正 #12367 - Fix: ウィジェットのジョブキューにて音声の発音方法変更に追従できていなかったのを修正 #12367
- Fix: コードエディタが正しく表示されない問題を修正
- Fix: プロフィールの「ファイル」にセンシティブな画像がある際のデザインを修正
### Server ### Server
- Enhance: MFM `$[ruby ]` が他ソフトウェアと連合されるように
- Fix: 時間経過により無効化されたアンテナを再有効化したとき、サーバ再起動までその状況が反映されないのを修正 #12303 - Fix: 時間経過により無効化されたアンテナを再有効化したとき、サーバ再起動までその状況が反映されないのを修正 #12303
- Fix: ロールタイムラインが保存されない問題を修正 - Fix: ロールタイムラインが保存されない問題を修正
- Fix: api.jsonの生成ロジックを改善 #12402 - Fix: api.jsonの生成ロジックを改善 #12402
- Fix: 招待コードが使い回せる問題を修正
## 2023.11.1 ## 2023.11.1

View file

@ -1,6 +1,6 @@
# syntax = docker/dockerfile:1.4 # syntax = docker/dockerfile:1.4
ARG NODE_VERSION=20.5.1-bullseye ARG NODE_VERSION=20.10.0-bullseye
# build assets & compile TypeScript # build assets & compile TypeScript

4
locales/index.d.ts vendored
View file

@ -729,6 +729,7 @@ export interface Locale {
"smtpSecureInfo": string; "smtpSecureInfo": string;
"testEmail": string; "testEmail": string;
"wordMute": string; "wordMute": string;
"hardWordMute": string;
"regexpError": string; "regexpError": string;
"regexpErrorDescription": string; "regexpErrorDescription": string;
"instanceMute": string; "instanceMute": string;
@ -1132,6 +1133,7 @@ export interface Locale {
"enableChartsForFederatedInstances": string; "enableChartsForFederatedInstances": string;
"showClipButtonInNoteFooter": string; "showClipButtonInNoteFooter": string;
"reactionsDisplaySize": string; "reactionsDisplaySize": string;
"limitWidthOfReaction": string;
"noteIdOrUrl": string; "noteIdOrUrl": string;
"video": string; "video": string;
"videos": string; "videos": string;
@ -1846,7 +1848,9 @@ export interface Locale {
"assignTarget": string; "assignTarget": string;
"descriptionOfAssignTarget": string; "descriptionOfAssignTarget": string;
"manual": string; "manual": string;
"manualRoles": string;
"conditional": string; "conditional": string;
"conditionalRoles": string;
"condition": string; "condition": string;
"isConditionalRole": string; "isConditionalRole": string;
"isPublic": string; "isPublic": string;

View file

@ -726,6 +726,7 @@ smtpSecure: "SMTP 接続に暗黙的なSSL/TLSを使用する"
smtpSecureInfo: "STARTTLS使用時はオフにします。" smtpSecureInfo: "STARTTLS使用時はオフにします。"
testEmail: "配信テスト" testEmail: "配信テスト"
wordMute: "ワードミュート" wordMute: "ワードミュート"
hardWordMute: "ハードワードミュート"
regexpError: "正規表現エラー" regexpError: "正規表現エラー"
regexpErrorDescription: "{tab}ワードミュートの{line}行目の正規表現にエラーが発生しました:" regexpErrorDescription: "{tab}ワードミュートの{line}行目の正規表現にエラーが発生しました:"
instanceMute: "サーバーミュート" instanceMute: "サーバーミュート"
@ -1129,6 +1130,7 @@ enableChartsForRemoteUser: "リモートユーザーのチャートを生成"
enableChartsForFederatedInstances: "リモートサーバーのチャートを生成" enableChartsForFederatedInstances: "リモートサーバーのチャートを生成"
showClipButtonInNoteFooter: "ノートのアクションにクリップを追加" showClipButtonInNoteFooter: "ノートのアクションにクリップを追加"
reactionsDisplaySize: "リアクションの表示サイズ" reactionsDisplaySize: "リアクションの表示サイズ"
limitWidthOfReaction: "リアクションの最大横幅を制限し、縮小して表示する"
noteIdOrUrl: "ートIDまたはURL" noteIdOrUrl: "ートIDまたはURL"
video: "動画" video: "動画"
videos: "動画" videos: "動画"
@ -1755,7 +1757,9 @@ _role:
assignTarget: "アサイン" assignTarget: "アサイン"
descriptionOfAssignTarget: "<b>マニュアル</b>は誰がこのロールに含まれるかを手動で管理します。\n<b>コンディショナル</b>は条件を設定し、それに合致するユーザーが自動で含まれるようになります。" descriptionOfAssignTarget: "<b>マニュアル</b>は誰がこのロールに含まれるかを手動で管理します。\n<b>コンディショナル</b>は条件を設定し、それに合致するユーザーが自動で含まれるようになります。"
manual: "マニュアル" manual: "マニュアル"
manualRoles: "マニュアルロール"
conditional: "コンディショナル" conditional: "コンディショナル"
conditionalRoles: "コンディショナルロール"
condition: "条件" condition: "条件"
isConditionalRole: "これはコンディショナルロールです。" isConditionalRole: "これはコンディショナルロールです。"
isPublic: "公開ロール" isPublic: "公開ロール"
@ -2157,7 +2161,7 @@ _ago:
weeksAgo: "{n}週間前" weeksAgo: "{n}週間前"
monthsAgo: "{n}ヶ月前" monthsAgo: "{n}ヶ月前"
yearsAgo: "{n}年前" yearsAgo: "{n}年前"
invalid: "ありません" invalid: "日時の解析に失敗"
_timeIn: _timeIn:
seconds: "{n}秒後" seconds: "{n}秒後"

View file

@ -0,0 +1,11 @@
export class HardMute1700383825690 {
name = 'HardMute1700383825690'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "user_profile" ADD "hardMutedWords" jsonb NOT NULL DEFAULT '[]'`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "user_profile" DROP COLUMN "hardMutedWords"`);
}
}

View file

@ -250,6 +250,12 @@ export class MfmService {
} }
} }
function fnDefault(node: mfm.MfmFn) {
const el = doc.createElement('i');
appendChildren(node.children, el);
return el;
}
const handlers: { [K in mfm.MfmNode['type']]: (node: mfm.NodeType<K>) => any } = { const handlers: { [K in mfm.MfmNode['type']]: (node: mfm.NodeType<K>) => any } = {
bold: (node) => { bold: (node) => {
const el = doc.createElement('b'); const el = doc.createElement('b');
@ -276,17 +282,68 @@ export class MfmService {
}, },
fn: (node) => { fn: (node) => {
if (node.props.name === 'unixtime') { switch (node.props.name) {
const text = node.children[0]!.type === 'text' ? node.children[0].props.text : ''; case 'unixtime': {
const date = new Date(parseInt(text, 10) * 1000); const text = node.children[0].type === 'text' ? node.children[0].props.text : '';
const el = doc.createElement('time'); try {
el.setAttribute('datetime', date.toISOString()); const date = new Date(parseInt(text, 10) * 1000);
el.textContent = date.toISOString(); const el = doc.createElement('time');
return el; el.setAttribute('datetime', date.toISOString());
} else { el.textContent = date.toISOString();
const el = doc.createElement('i'); return el;
appendChildren(node.children, el); } catch (err) {
return el; return fnDefault(node);
}
}
case 'ruby': {
if (node.children.length === 1) {
const child = node.children[0];
const text = child.type === 'text' ? child.props.text : '';
const rubyEl = doc.createElement('ruby');
const rtEl = doc.createElement('rt');
// ruby未対応のHTMLサニタイザーを通したときにルビが「劉備りゅうび」となるようにする
const rpStartEl = doc.createElement('rp');
rpStartEl.appendChild(doc.createTextNode('('));
const rpEndEl = doc.createElement('rp');
rpEndEl.appendChild(doc.createTextNode(')'));
rubyEl.appendChild(doc.createTextNode(text.split(' ')[0]));
rtEl.appendChild(doc.createTextNode(text.split(' ')[1]));
rubyEl.appendChild(rpStartEl);
rubyEl.appendChild(rtEl);
rubyEl.appendChild(rpEndEl);
return rubyEl;
} else {
const rt = node.children.at(-1);
if (!rt) {
return fnDefault(node);
}
const text = rt.type === 'text' ? rt.props.text : '';
const rubyEl = doc.createElement('ruby');
const rtEl = doc.createElement('rt');
// ruby未対応のHTMLサニタイザーを通したときにルビが「劉備りゅうび」となるようにする
const rpStartEl = doc.createElement('rp');
rpStartEl.appendChild(doc.createTextNode('('));
const rpEndEl = doc.createElement('rp');
rpEndEl.appendChild(doc.createTextNode(')'));
appendChildren(node.children.slice(0, node.children.length - 1), rubyEl);
rtEl.appendChild(doc.createTextNode(text.trim()));
rubyEl.appendChild(rpStartEl);
rubyEl.appendChild(rtEl);
rubyEl.appendChild(rpEndEl);
return rubyEl;
}
}
default: {
return fnDefault(node);
}
} }
}, },

View file

@ -510,6 +510,7 @@ export class UserEntityService implements OnModuleInit {
hasPendingReceivedFollowRequest: this.getHasPendingReceivedFollowRequest(user.id), hasPendingReceivedFollowRequest: this.getHasPendingReceivedFollowRequest(user.id),
unreadNotificationsCount: notificationsInfo?.unreadCount, unreadNotificationsCount: notificationsInfo?.unreadCount,
mutedWords: profile!.mutedWords, mutedWords: profile!.mutedWords,
hardMutedWords: profile!.hardMutedWords,
mutedInstances: profile!.mutedInstances, mutedInstances: profile!.mutedInstances,
mutingNotificationTypes: [], // 後方互換性のため mutingNotificationTypes: [], // 後方互換性のため
notificationRecieveConfig: profile!.notificationRecieveConfig, notificationRecieveConfig: profile!.notificationRecieveConfig,

View file

@ -215,7 +215,12 @@ export class MiUserProfile {
@Column('jsonb', { @Column('jsonb', {
default: [], default: [],
}) })
public mutedWords: string[][]; public mutedWords: (string[] | string)[];
@Column('jsonb', {
default: [],
})
public hardMutedWords: (string[] | string)[];
@Column('jsonb', { @Column('jsonb', {
default: [], default: [],

View file

@ -534,6 +534,18 @@ export const packedMeDetailedOnlySchema = {
}, },
}, },
}, },
hardMutedWords: {
type: 'array',
nullable: false, optional: false,
items: {
type: 'array',
nullable: false, optional: false,
items: {
type: 'string',
nullable: false, optional: false,
},
},
},
mutedInstances: { mutedInstances: {
type: 'array', type: 'array',
nullable: true, optional: false, nullable: true, optional: false,

View file

@ -126,7 +126,7 @@ export class SignupApiService {
code: invitationCode, code: invitationCode,
}); });
if (ticket == null) { if (ticket == null || ticket.usedById != null) {
reply.code(400); reply.code(400);
return; return;
} }

View file

@ -123,6 +123,11 @@ export const meta = {
}, },
} as const; } as const;
const muteWords = { type: 'array', items: { oneOf: [
{ type: 'array', items: { type: 'string' } },
{ type: 'string' }
] } } as const;
export const paramDef = { export const paramDef = {
type: 'object', type: 'object',
properties: { properties: {
@ -171,7 +176,8 @@ export const paramDef = {
autoSensitive: { type: 'boolean' }, autoSensitive: { type: 'boolean' },
ffVisibility: { type: 'string', enum: ['public', 'followers', 'private'] }, ffVisibility: { type: 'string', enum: ['public', 'followers', 'private'] },
pinnedPageId: { type: 'string', format: 'misskey:id', nullable: true }, pinnedPageId: { type: 'string', format: 'misskey:id', nullable: true },
mutedWords: { type: 'array' }, mutedWords: muteWords,
hardMutedWords: muteWords,
mutedInstances: { type: 'array', items: { mutedInstances: { type: 'array', items: {
type: 'string', type: 'string',
} }, } },
@ -234,16 +240,20 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (ps.location !== undefined) profileUpdates.location = ps.location; if (ps.location !== undefined) profileUpdates.location = ps.location;
if (ps.birthday !== undefined) profileUpdates.birthday = ps.birthday; if (ps.birthday !== undefined) profileUpdates.birthday = ps.birthday;
if (ps.ffVisibility !== undefined) profileUpdates.ffVisibility = ps.ffVisibility; if (ps.ffVisibility !== undefined) profileUpdates.ffVisibility = ps.ffVisibility;
if (ps.mutedWords !== undefined) {
function checkMuteWordCount(mutedWords: (string[] | string)[], limit: number) {
// TODO: ちゃんと数える // TODO: ちゃんと数える
const length = JSON.stringify(ps.mutedWords).length; const length = JSON.stringify(ps.mutedWords).length;
if (length > (await this.roleService.getUserPolicies(user.id)).wordMuteLimit) { if (length > limit) {
throw new ApiError(meta.errors.tooManyMutedWords); throw new ApiError(meta.errors.tooManyMutedWords);
} }
}
// validate regular expression syntax function validateMuteWordRegex(mutedWords: (string[] | string)[]) {
ps.mutedWords.filter(x => !Array.isArray(x)).forEach(x => { for (const mutedWord of mutedWords) {
const regexp = x.match(/^\/(.+)\/(.*)$/); if (typeof mutedWord !== "string") continue;
const regexp = mutedWord.match(/^\/(.+)\/(.*)$/);
if (!regexp) throw new ApiError(meta.errors.invalidRegexp); if (!regexp) throw new ApiError(meta.errors.invalidRegexp);
try { try {
@ -251,11 +261,21 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
} catch (err) { } catch (err) {
throw new ApiError(meta.errors.invalidRegexp); throw new ApiError(meta.errors.invalidRegexp);
} }
}); }
}
if (ps.mutedWords !== undefined) {
checkMuteWordCount(ps.mutedWords, (await this.roleService.getUserPolicies(user.id)).wordMuteLimit);
validateMuteWordRegex(ps.mutedWords);
profileUpdates.mutedWords = ps.mutedWords; profileUpdates.mutedWords = ps.mutedWords;
profileUpdates.enableWordMute = ps.mutedWords.length > 0; profileUpdates.enableWordMute = ps.mutedWords.length > 0;
} }
if (ps.hardMutedWords !== undefined) {
checkMuteWordCount(ps.hardMutedWords, (await this.roleService.getUserPolicies(user.id)).wordMuteLimit);
validateMuteWordRegex(ps.hardMutedWords);
profileUpdates.hardMutedWords = ps.hardMutedWords;
}
if (ps.mutedInstances !== undefined) profileUpdates.mutedInstances = ps.mutedInstances; if (ps.mutedInstances !== undefined) profileUpdates.mutedInstances = ps.mutedInstances;
if (ps.notificationRecieveConfig !== undefined) profileUpdates.notificationRecieveConfig = ps.notificationRecieveConfig; if (ps.notificationRecieveConfig !== undefined) profileUpdates.notificationRecieveConfig = ps.notificationRecieveConfig;
if (typeof ps.isLocked === 'boolean') updates.isLocked = ps.isLocked; if (typeof ps.isLocked === 'boolean') updates.isLocked = ps.isLocked;

View file

@ -273,7 +273,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
if (renote.channelId && renote.channelId !== ps.channelId) { if (renote.channelId && renote.channelId !== ps.channelId) {
// チャンネルのノートに対しリノート要求がきたとき、チャンネル外へのリノート可否をチェック // チャンネルのノートに対しリノート要求がきたとき、チャンネル外へのリノート可否をチェック
// リートのユースケースのうち、チャンネル内→チャンネル外は少数だと考えられるため、JOINはせず必要な時に都度取得する // リートのユースケースのうち、チャンネル内→チャンネル外は少数だと考えられるため、JOINはせず必要な時に都度取得する
const renoteChannel = await this.channelsRepository.findOneById(renote.channelId); const renoteChannel = await this.channelsRepository.findOneBy({ id: renote.channelId });
if (renoteChannel == null) { if (renoteChannel == null) {
// リノートしたいノートが書き込まれているチャンネルが無い // リノートしたいノートが書き込まれているチャンネルが無い
throw new ApiError(meta.errors.noSuchChannel); throw new ApiError(meta.errors.noSuchChannel);

View file

@ -169,6 +169,7 @@ describe('ユーザー', () => {
hasPendingReceivedFollowRequest: user.hasPendingReceivedFollowRequest, hasPendingReceivedFollowRequest: user.hasPendingReceivedFollowRequest,
unreadAnnouncements: user.unreadAnnouncements, unreadAnnouncements: user.unreadAnnouncements,
mutedWords: user.mutedWords, mutedWords: user.mutedWords,
hardMutedWords: user.hardMutedWords,
mutedInstances: user.mutedInstances, mutedInstances: user.mutedInstances,
mutingNotificationTypes: user.mutingNotificationTypes, mutingNotificationTypes: user.mutingNotificationTypes,
notificationRecieveConfig: user.notificationRecieveConfig, notificationRecieveConfig: user.notificationRecieveConfig,

View file

@ -1593,7 +1593,8 @@ export type Endpoints = {
injectFeaturedNote?: boolean; injectFeaturedNote?: boolean;
receiveAnnouncementEmail?: boolean; receiveAnnouncementEmail?: boolean;
alwaysMarkNsfw?: boolean; alwaysMarkNsfw?: boolean;
mutedWords?: string[][]; mutedWords?: (string[] | string)[];
hardMutedWords?: (string[] | string)[];
notificationRecieveConfig?: any; notificationRecieveConfig?: any;
emailNotificationTypes?: string[]; emailNotificationTypes?: string[];
alsoKnownAs?: string[]; alsoKnownAs?: string[];
@ -2581,7 +2582,8 @@ type MeDetailed = UserDetailed & {
integrations: Record<string, any>; integrations: Record<string, any>;
isDeleted: boolean; isDeleted: boolean;
isExplorable: boolean; isExplorable: boolean;
mutedWords: string[][]; mutedWords: (string[] | string)[];
hardMutedWords: (string[] | string)[];
notificationRecieveConfig: { notificationRecieveConfig: {
[notificationType in typeof notificationTypes_2[number]]?: { [notificationType in typeof notificationTypes_2[number]]?: {
type: 'all'; type: 'all';
@ -3127,9 +3129,9 @@ type UserSorting = '+follower' | '-follower' | '+createdAt' | '-createdAt' | '+u
// //
// src/api.types.ts:16:32 - (ae-forgotten-export) The symbol "TODO" needs to be exported by the entry point index.d.ts // src/api.types.ts:16:32 - (ae-forgotten-export) The symbol "TODO" needs to be exported by the entry point index.d.ts
// src/api.types.ts:20:25 - (ae-forgotten-export) The symbol "NoParams" needs to be exported by the entry point index.d.ts // src/api.types.ts:20:25 - (ae-forgotten-export) The symbol "NoParams" needs to be exported by the entry point index.d.ts
// src/api.types.ts:663:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts // src/api.types.ts:664:18 - (ae-forgotten-export) The symbol "ShowUserReq" needs to be exported by the entry point index.d.ts
// src/entities.ts:116:2 - (ae-forgotten-export) The symbol "notificationTypes_2" needs to be exported by the entry point index.d.ts // src/entities.ts:117:2 - (ae-forgotten-export) The symbol "notificationTypes_2" needs to be exported by the entry point index.d.ts
// src/entities.ts:637:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts // src/entities.ts:638:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts
// src/streaming.types.ts:33:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts // src/streaming.types.ts:33:4 - (ae-forgotten-export) The symbol "FIXME" needs to be exported by the entry point index.d.ts
// (No @packageDocumentation comment for this package) // (No @packageDocumentation comment for this package)

View file

@ -439,7 +439,8 @@ export type Endpoints = {
injectFeaturedNote?: boolean; injectFeaturedNote?: boolean;
receiveAnnouncementEmail?: boolean; receiveAnnouncementEmail?: boolean;
alwaysMarkNsfw?: boolean; alwaysMarkNsfw?: boolean;
mutedWords?: string[][]; mutedWords?: (string[] | string)[];
hardMutedWords?: (string[] | string)[];
notificationRecieveConfig?: any; notificationRecieveConfig?: any;
emailNotificationTypes?: string[]; emailNotificationTypes?: string[];
alsoKnownAs?: string[]; alsoKnownAs?: string[];

View file

@ -112,7 +112,8 @@ export type MeDetailed = UserDetailed & {
integrations: Record<string, any>; integrations: Record<string, any>;
isDeleted: boolean; isDeleted: boolean;
isExplorable: boolean; isExplorable: boolean;
mutedWords: string[][]; mutedWords: (string[] | string)[];
hardMutedWords: (string[] | string)[];
notificationRecieveConfig: { notificationRecieveConfig: {
[notificationType in typeof notificationTypes[number]]?: { [notificationType in typeof notificationTypes[number]]?: {
type: 'all'; type: 'all';

View file

@ -139,6 +139,10 @@ watch(v, () => {
height: 100%; height: 100%;
} }
.textarea, .codeEditorHighlighter {
margin: 0;
}
.textarea { .textarea {
position: absolute; position: absolute;
top: 0; top: 0;
@ -154,6 +158,8 @@ watch(v, () => {
background-color: transparent; background-color: transparent;
border: 0; border: 0;
outline: 0; outline: 0;
min-width: calc(100% - 24px);
height: calc(100% - 24px);
padding: 12px; padding: 12px;
line-height: 1.5em; line-height: 1.5em;
font-size: 1em; font-size: 1em;

View file

@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template> <template>
<div <div
v-if="!muted" v-if="!hardMuted && !muted"
v-show="!isDeleted" v-show="!isDeleted"
ref="el" ref="el"
v-hotkey="keymap" v-hotkey="keymap"
@ -180,7 +180,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
</article> </article>
</div> </div>
<div v-else :class="$style.muted" @click="muted = false"> <div v-else-if="!hardMuted" :class="$style.muted" @click="muted = false">
<I18n :src="i18n.ts.userSaysSomething" tag="small"> <I18n :src="i18n.ts.userSaysSomething" tag="small">
<template #name> <template #name>
<MkA v-user-preview="appearNote.userId" :to="userPage(appearNote.user)"> <MkA v-user-preview="appearNote.userId" :to="userPage(appearNote.user)">
@ -238,7 +238,8 @@ let showEl = $ref(false);
const props = withDefaults(defineProps<{ const props = withDefaults(defineProps<{
note: Misskey.entities.Note; note: Misskey.entities.Note;
pinned?: boolean; pinned?: boolean;
mock?: boolean; mock?: boolean;
withHardMute?: boolean;
notification?: boolean; notification?: boolean;
}>(), { }>(), {
mock: false, mock: false,
@ -299,7 +300,8 @@ const isLong = shouldCollapsed(appearNote, urls ?? []);
const isMFM = shouldMfmCollapsed(appearNote); const isMFM = shouldMfmCollapsed(appearNote);
const collapsed = ref(appearNote.cw == null && (isLong || (isMFM && defaultStore.state.collapseDefault) || defaultStore.state.allMediaNoteCollapse)); const collapsed = ref(appearNote.cw == null && (isLong || (isMFM && defaultStore.state.collapseDefault) || defaultStore.state.allMediaNoteCollapse));
const isDeleted = ref(false); const isDeleted = ref(false);
const muted = ref($i ? checkWordMute(appearNote, $i, $i.mutedWords) : false); const muted = ref(checkMute(appearNote, $i?.mutedWords));
const hardMuted = ref(props.withHardMute && checkMute(appearNote, $i?.hardMutedWords));
const translation = ref<any>(null); const translation = ref<any>(null);
const translating = ref(false); const translating = ref(false);
const viewTextSource = ref(false); const viewTextSource = ref(false);
@ -313,6 +315,15 @@ const collapseLabel = computed(() => {
] as string[][]).join(' / '); ] as string[][]).join(' / ');
}); });
function checkMute(note: Misskey.entities.Note, mutedWords: Array<string | string[]> | undefined | null): boolean {
if (mutedWords == null) return false;
if (checkWordMute(note, $i, mutedWords)) return true;
if (note.reply && checkWordMute(note.reply, $i, mutedWords)) return true;
if (note.renote && checkWordMute(note.renote, $i, mutedWords)) return true;
return false;
}
const keymap = { const keymap = {
'r': () => reply(true), 'r': () => reply(true),
'e|a|plus': () => react(true), 'e|a|plus': () => react(true),

View file

@ -25,7 +25,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:ad="true" :ad="true"
:class="$style.notes" :class="$style.notes"
> >
<MkNote :key="note._featuredId_ || note._prId_ || note.id" :class="$style.note" :note="note"/> <MkNote :key="note._featuredId_ || note._prId_ || note.id" :class="$style.note" :note="note" :withHardMute="true"/>
</MkDateSeparatedList> </MkDateSeparatedList>
</div> </div>
</template> </template>

View file

@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #default="{ items: notifications }"> <template #default="{ items: notifications }">
<MkDateSeparatedList v-slot="{ item: notification }" :class="$style.list" :items="notifications" :noGap="!defaultStore.state.showGapBetweenNotesInTimeline || mainRouter.currentRoute.value.name !== 'my-notifications'"> <MkDateSeparatedList v-slot="{ item: notification }" :class="$style.list" :items="notifications" :noGap="!defaultStore.state.showGapBetweenNotesInTimeline || mainRouter.currentRoute.value.name !== 'my-notifications'">
<MkNote v-if="['reply', 'quote', 'mention'].includes(notification.type)" :key="notification.id" :note="notification.note" :notification="true"/> <MkNote v-if="['reply', 'quote', 'mention'].includes(notification.type)" :key="notification.id" :note="notification.note" :notification="true" :withHardMute="true"/>
<XNotification v-else :key="notification.id" :notification="notification" :withTime="true" :full="true" class="_panel"/> <XNotification v-else :key="notification.id" :notification="notification" :withTime="true" :full="true" class="_panel"/>
</MkDateSeparatedList> </MkDateSeparatedList>
</template> </template>

View file

@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
:class="[$style.root, { [$style.reacted]: note.myReaction == reaction, [$style.canToggle]: (canToggle || alternative), [$style.small]: defaultStore.state.reactionsDisplaySize === 'small', [$style.large]: defaultStore.state.reactionsDisplaySize === 'large' }]" :class="[$style.root, { [$style.reacted]: note.myReaction == reaction, [$style.canToggle]: (canToggle || alternative), [$style.small]: defaultStore.state.reactionsDisplaySize === 'small', [$style.large]: defaultStore.state.reactionsDisplaySize === 'large' }]"
@click="toggleReaction()" @click="toggleReaction()"
> >
<MkReactionIcon :class="$style.icon" :reaction="reaction" :emojiUrl="note.reactionEmojis[reaction.substring(1, reaction.length - 1)]"/> <MkReactionIcon :class="defaultStore.state.limitWidthOfReaction ? $style.limitWidth : ''" :reaction="reaction" :emojiUrl="note.reactionEmojis[reaction.substring(1, reaction.length - 1)]"/>
<span :class="$style.count">{{ count }}</span> <span :class="$style.count">{{ count }}</span>
</button> </button>
</template> </template>
@ -211,7 +211,7 @@ if (!mock) {
} }
} }
.icon { .limitWidth {
max-width: 150px; max-width: 150px;
} }

View file

@ -29,12 +29,25 @@ const props = withDefaults(defineProps<{
mode: 'relative', mode: 'relative',
}); });
const _time = props.time == null ? NaN : function getDateSafe(n: Date | string | number) {
typeof props.time === 'number' ? props.time : try {
(props.time instanceof Date ? props.time : new Date(props.time)).getTime(); if (n instanceof Date) {
return n;
}
return new Date(n);
} catch (err) {
return {
getTime: () => NaN,
};
}
}
// eslint-disable-next-line vue/no-setup-props-destructure
const _time = props.time == null ? NaN : getDateSafe(props.time).getTime();
const invalid = Number.isNaN(_time); const invalid = Number.isNaN(_time);
const absolute = !invalid ? dateTimeFormat.format(_time) : i18n.ts._ago.invalid; const absolute = !invalid ? dateTimeFormat.format(_time) : i18n.ts._ago.invalid;
// eslint-disable-next-line vue/no-setup-props-destructure
let now = $ref((props.origin ?? new Date()).getTime()); let now = $ref((props.origin ?? new Date()).getTime());
const ago = $computed(() => (now - _time) / 1000/*ms*/); const ago = $computed(() => (now - _time) / 1000/*ms*/);

View file

@ -205,13 +205,13 @@ SPDX-License-Identifier: AGPL-3.0-only
</MkFolder> </MkFolder>
<div class="_gaps_s"> <div class="_gaps_s">
<MkFoldableSection> <MkFoldableSection>
<template #header>Manual roles</template> <template #header>{{ i18n.ts._role.manualRoles }}</template>
<div class="_gaps_s"> <div class="_gaps_s">
<MkRolePreview v-for="role in roles.filter(x => x.target === 'manual')" :key="role.id" :role="role" :forModeration="true"/> <MkRolePreview v-for="role in roles.filter(x => x.target === 'manual')" :key="role.id" :role="role" :forModeration="true"/>
</div> </div>
</MkFoldableSection> </MkFoldableSection>
<MkFoldableSection> <MkFoldableSection>
<template #header>Conditional roles</template> <template #header>{{ i18n.ts._role.conditionalRoles }}</template>
<div class="_gaps_s"> <div class="_gaps_s">
<MkRolePreview v-for="role in roles.filter(x => x.target === 'conditional')" :key="role.id" :role="role" :forModeration="true"/> <MkRolePreview v-for="role in roles.filter(x => x.target === 'conditional')" :key="role.id" :role="role" :forModeration="true"/>
</div> </div>

View file

@ -66,6 +66,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="medium">{{ i18n.ts.medium }}</option> <option value="medium">{{ i18n.ts.medium }}</option>
<option value="large">{{ i18n.ts.large }}</option> <option value="large">{{ i18n.ts.large }}</option>
</MkRadios> </MkRadios>
<MkSwitch v-model="limitWidthOfReaction">{{ i18n.ts.limitWidthOfReaction }}</MkSwitch>
<MkSwitch v-model="hideAvatarsInNote">{{ i18n.ts.hideAvatarsInNote }} <span class="_beta">CherryPick</span></MkSwitch> <MkSwitch v-model="hideAvatarsInNote">{{ i18n.ts.hideAvatarsInNote }} <span class="_beta">CherryPick</span></MkSwitch>
<MkSwitch v-model="enableAbsoluteTime">{{ i18n.ts.enableAbsoluteTime }} <span class="_beta">CherryPick</span></MkSwitch> <MkSwitch v-model="enableAbsoluteTime">{{ i18n.ts.enableAbsoluteTime }} <span class="_beta">CherryPick</span></MkSwitch>
<MkSwitch v-model="enableMarkByDate" :disabled="defaultStore.state.enableAbsoluteTime">{{ i18n.ts.enableMarkByDate }} <span class="_beta">CherryPick</span></MkSwitch> <MkSwitch v-model="enableMarkByDate" :disabled="defaultStore.state.enableAbsoluteTime">{{ i18n.ts.enableMarkByDate }} <span class="_beta">CherryPick</span></MkSwitch>
@ -338,6 +339,7 @@ const serverDisconnectedBehavior = computed(defaultStore.makeGetterSetter('serve
const showNoteActionsOnlyHover = computed(defaultStore.makeGetterSetter('showNoteActionsOnlyHover')); const showNoteActionsOnlyHover = computed(defaultStore.makeGetterSetter('showNoteActionsOnlyHover'));
const showClipButtonInNoteFooter = computed(defaultStore.makeGetterSetter('showClipButtonInNoteFooter')); const showClipButtonInNoteFooter = computed(defaultStore.makeGetterSetter('showClipButtonInNoteFooter'));
const reactionsDisplaySize = computed(defaultStore.makeGetterSetter('reactionsDisplaySize')); const reactionsDisplaySize = computed(defaultStore.makeGetterSetter('reactionsDisplaySize'));
const limitWidthOfReaction = computed(defaultStore.makeGetterSetter('limitWidthOfReaction'));
const collapseRenotes = computed(defaultStore.makeGetterSetter('collapseRenotes')); const collapseRenotes = computed(defaultStore.makeGetterSetter('collapseRenotes'));
const reduceAnimation = computed(defaultStore.makeGetterSetter('animation', v => !v, v => !v)); const reduceAnimation = computed(defaultStore.makeGetterSetter('animation', v => !v, v => !v));
const useBlurEffectForModal = computed(defaultStore.makeGetterSetter('useBlurEffectForModal')); const useBlurEffectForModal = computed(defaultStore.makeGetterSetter('useBlurEffectForModal'));
@ -433,6 +435,7 @@ watch([
overridedDeviceKind, overridedDeviceKind,
mediaListWithOneImageAppearance, mediaListWithOneImageAppearance,
reactionsDisplaySize, reactionsDisplaySize,
limitWidthOfReaction,
highlightSensitiveMedia, highlightSensitiveMedia,
keepScreenOn, keepScreenOn,
disableStreamingTimeline, disableStreamingTimeline,

View file

@ -9,7 +9,14 @@ SPDX-License-Identifier: AGPL-3.0-only
<template #icon><i class="ti ti-message-off"></i></template> <template #icon><i class="ti ti-message-off"></i></template>
<template #label>{{ i18n.ts.wordMute }}</template> <template #label>{{ i18n.ts.wordMute }}</template>
<XWordMute/> <XWordMute :muted="$i!.mutedWords" @save="saveMutedWords"/>
</MkFolder>
<MkFolder>
<template #icon><i class="ti ti-message-off"></i></template>
<template #label>{{ i18n.ts.hardWordMute }}</template>
<XWordMute :muted="$i!.hardMutedWords" @save="saveHardMutedWords"/>
</MkFolder> </MkFolder>
<MkFolder> <MkFolder>
@ -129,6 +136,7 @@ import { definePageMetadata } from '@/scripts/page-metadata.js';
import MkUserCardMini from '@/components/MkUserCardMini.vue'; import MkUserCardMini from '@/components/MkUserCardMini.vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
import { infoImageUrl } from '@/instance.js'; import { infoImageUrl } from '@/instance.js';
import { $i } from '@/account.js';
import MkFolder from '@/components/MkFolder.vue'; import MkFolder from '@/components/MkFolder.vue';
const renoteMutingPagination = { const renoteMutingPagination = {
@ -207,6 +215,14 @@ async function toggleBlockItem(item) {
} }
} }
async function saveMutedWords(mutedWords: (string | string[])[]) {
await os.api('i/update', { mutedWords });
}
async function saveHardMutedWords(hardMutedWords: (string | string[])[]) {
await os.api('i/update', { hardMutedWords });
}
const headerActions = $computed(() => []); const headerActions = $computed(() => []);
const headerTabs = $computed(() => []); const headerTabs = $computed(() => []);

View file

@ -18,16 +18,17 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup> <script lang="ts" setup>
import { ref, watch } from 'vue'; import { ref, watch } from 'vue';
import MkTextarea from '@/components/MkTextarea.vue'; import MkTextarea from '@/components/MkTextarea.vue';
import MkKeyValue from '@/components/MkKeyValue.vue';
import MkButton from '@/components/MkButton.vue'; import MkButton from '@/components/MkButton.vue';
import MkInfo from '@/components/MkInfo.vue';
import MkTab from '@/components/MkTab.vue';
import * as os from '@/os.js'; import * as os from '@/os.js';
import number from '@/filters/number.js';
import { defaultStore } from '@/store.js';
import { $i } from '@/account.js';
import { i18n } from '@/i18n.js'; import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
const props = defineProps<{
muted: (string[] | string)[];
}>();
const emit = defineEmits<{
(ev: 'save', value: (string[] | string)[]): void;
}>();
const render = (mutedWords) => mutedWords.map(x => { const render = (mutedWords) => mutedWords.map(x => {
if (Array.isArray(x)) { if (Array.isArray(x)) {
@ -37,8 +38,7 @@ const render = (mutedWords) => mutedWords.map(x => {
} }
}).join('\n'); }).join('\n');
const tab = ref('soft'); const mutedWords = ref(render(props.muted));
const mutedWords = ref(render($i!.mutedWords));
const changed = ref(false); const changed = ref(false);
watch(mutedWords, () => { watch(mutedWords, () => {
@ -85,9 +85,7 @@ async function save() {
return; return;
} }
await os.api('i/update', { emit('save', parsed);
mutedWords: parsed,
});
changed.value = false; changed.value = false;
} }

View file

@ -11,10 +11,14 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkLoading v-if="fetching"/> <MkLoading v-if="fetching"/>
<div v-if="!fetching && files.length > 0" :class="$style.stream"> <div v-if="!fetching && files.length > 0" :class="$style.stream">
<template v-for="file in files" :key="file.note.id + file.file.id"> <template v-for="file in files" :key="file.note.id + file.file.id">
<div v-if="file.file.isSensitive && !showingFiles.includes(file.file.id)" :class="$style.sensitive" @click="showingFiles.push(file.file.id)"> <div v-if="file.file.isSensitive && !showingFiles.includes(file.file.id)" :class="$style.img" @click="showingFiles.push(file.file.id)">
<div> <!-- TODO: 画像以外のファイルに対応 -->
<div><i class="ti ti-eye-exclamation"></i> {{ i18n.ts.sensitive }}</div> <ImgWithBlurhash :class="$style.sensitiveImg" :hash="file.file.blurhash" :src="thumbnail(file.file)" :title="file.file.name" :forceBlurhash="true"/>
<div>{{ i18n.ts.clickToShow }}</div> <div :class="$style.sensitive">
<div>
<div><i class="ti ti-eye-exclamation"></i> {{ i18n.ts.sensitive }}</div>
<div>{{ i18n.ts.clickToShow }}</div>
</div>
</div> </div>
</div> </div>
<MkA v-else :class="$style.img" :to="notePage(file.note)"> <MkA v-else :class="$style.img" :to="notePage(file.note)">
@ -122,6 +126,7 @@ onUnmounted(() => {
} }
.img { .img {
position: relative;
height: 128px; height: 128px;
border-radius: 6px; border-radius: 6px;
overflow: clip; overflow: clip;
@ -133,8 +138,24 @@ onUnmounted(() => {
text-align: center; text-align: center;
} }
.sensitiveImg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
filter: brightness(0.7);
}
.sensitive { .sensitive {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: grid; display: grid;
place-items: center; place-items: center;
font-size: 0.8em;
color: #fff;
cursor: pointer;
} }
</style> </style>

View file

@ -347,6 +347,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'device', where: 'device',
default: 'small' as 'small' | 'medium' | 'large', default: 'small' as 'small' | 'medium' | 'large',
}, },
limitWidthOfReaction: {
where: 'device',
default: true,
},
forceShowAds: { forceShowAds: {
where: 'device', where: 'device',
default: true, default: true,