From 56a43dc01d15f1d41bbda9a973da18294389d7c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=8B=E3=81=A3=E3=81=93=E3=81=8B=E3=82=8A?= <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Fri, 19 Jul 2024 10:11:44 +0900 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20blurhash=E3=81=8C=E7=84=A1?= =?UTF-8?q?=E3=81=84=E5=A0=B4=E5=90=88=E3=81=AB=E4=BD=95=E3=82=82=E5=87=BA?= =?UTF-8?q?=E5=8A=9B=E3=81=95=E3=82=8C=E3=81=AA=E3=81=84=E3=81=AE=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20(#14250)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(frontend): blurhashが無い場合に何も出力されないのを修正 * Update Changelog * Update packages/frontend/src/components/MkImgWithBlurhash.vue Co-authored-by: tamaina * attempt to fix test * Update packages/frontend/src/components/MkImgWithBlurhash.vue Co-authored-by: tamaina * attempt to ignore test --------- Co-authored-by: tamaina --- CHANGELOG.md | 1 + packages/frontend/src/components/MkImgWithBlurhash.vue | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cf77d6083..b020c214bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -45,6 +45,7 @@ - Fix: Twitchの埋め込みが開けない問題を修正 - Fix: 子メニューの高さがウィンドウからはみ出ることがある問題を修正 - Fix: 個人宛てのダイアログ形式のお知らせが即時表示されない問題を修正 +- Fix: 一部の画像がセンシティブ指定されているときに画面に何も表示されないことがあるのを修正 ### Server - Feat: レートリミット制限に引っかかったときに`Retry-After`ヘッダーを返すように (#13949) diff --git a/packages/frontend/src/components/MkImgWithBlurhash.vue b/packages/frontend/src/components/MkImgWithBlurhash.vue index 617404f5c4..8d301f16bd 100644 --- a/packages/frontend/src/components/MkImgWithBlurhash.vue +++ b/packages/frontend/src/components/MkImgWithBlurhash.vue @@ -151,22 +151,26 @@ function drawImage(bitmap: CanvasImageSource) { } function drawAvg() { - if (!canvas.value || !props.hash) return; + if (!canvas.value) return; + + const color = (props.hash != null && extractAvgColorFromBlurhash(props.hash)) || '#888'; const ctx = canvas.value.getContext('2d'); if (!ctx) return; // avgColorでお茶をにごす ctx.beginPath(); - ctx.fillStyle = extractAvgColorFromBlurhash(props.hash) ?? '#888'; + ctx.fillStyle = color; ctx.fillRect(0, 0, canvasWidth.value, canvasHeight.value); } async function draw() { - if (props.hash == null) return; + if (import.meta.env.MODE === 'test' && props.hash == null) return; drawAvg(); + if (props.hash == null) return; + if (props.onlyAvgColor) return; const work = await canvasPromise;