# 拡大チャットで画像付きメッセージ投稿後、画像が開けない

**URL:** https://meta.discourse.org/t/images-in-an-enlarged-chat-cannot-be-opened-after-a-message-with-the-image-is-posted/352881
**Category:** Bug
**Tags:** chat
**Created:** [2025 年 2 月 18 日午前 11:20 UTC](https://meta.discourse.org/t/images-in-an-enlarged-chat-cannot-be-opened-after-a-message-with-the-image-is-posted/352881 "2025-02-18T11:20:56Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![meglio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/meglio/32/71444_2.png) [@meglio](https://meta.discourse.org/u/meglio)
#### Post date: [2025 年 2 月 18 日午前 11:20 UTC](https://meta.discourse.org/t/images-in-an-enlarged-chat-cannot-be-opened-after-a-message-with-the-image-is-posted/352881/1 "2025-02-18T11:20:56Z")

</div>

再現手順：

**1.** チャットを拡大表示：

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/3/b/43b187aa0b86b903a8a587d0b2ca4b246cbb2bec.png)

**2.1.** 中〜大サイズの画像を投稿し、メッセージ内の画像をクリックするとポップアップで拡大表示されることを期待する。

または

**2.2.** チャットで他の人からそのようなメッセージを受信する。

**3.** 画像をクリックする。開かない。

回避策：

**4.** ブラウザでページを更新する。

**5.** 画像をクリックする。これで、より大きなサイズの画像が表示されるポップアップが開くようになる。

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2025 年 2 月 19 日午前 8:39 UTC](https://meta.discourse.org/t/images-in-an-enlarged-chat-cannot-be-opened-after-a-message-with-the-image-is-posted/352881/2 "2025-02-19T08:39:12Z")

</div>

それは最近の退行ですか？

---

<div class="post-metadata">

### Author: ![pmusaraj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pmusaraj/32/119489_2.png) [@pmusaraj](https://meta.discourse.org/u/pmusaraj)
#### Post date: [2025 年 2 月 19 日午後 9:25 UTC](https://meta.discourse.org/t/images-in-an-enlarged-chat-cannot-be-opened-after-a-message-with-the-image-is-posted/352881/3 "2025-02-19T21:25:26Z")

</div>

はい、私も今日これを見ました。最近の後退現象だと思います。

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [2025 年 2 月 20 日午前 2:03 UTC](https://meta.discourse.org/t/images-in-an-enlarged-chat-cannot-be-opened-after-a-message-with-the-image-is-posted/352881/5 "2025-02-20T02:03:47Z")

</div>

問題はここにあると思います。

 ![画像はテキストエディタにコードが表示されているコンピュータ画面を示しており、変数宣言「this.getChatElement()」が入力中で「I」文字が補完待ちの状態にあるハイライトされたコーディング演習セクションが表示されています。(AIによるキャプション)](https://global.discourse-cdn.com/meta/original/4X/0/7/9/07974c456886eb0d2a74142b564df0ab7a6a2f21.png)

```js
api.decorateChatMessage(
      (element) =>
        lightbox(element.querySelectorAll("img:not(.emoji, .avatar)")),
      {
        id: "lightbox",
      }
    );

```

以前は、`api.decorateChatMessage` は `.chat-message-container` 要素を渡していました。

 ![画像は、クラス属性に「flex」や「grid」などのチャットメッセージコンテナを含む、さまざまなネストされたdiv要素で構成されたHTMLコードの断片を表示しています。(AIによるキャプション)](https://global.discourse-cdn.com/meta/original/4X/3/7/8/37828a163d08d3e45c8f718a204dc31988f3dd11.png)

その後、`.chat-cooked` 要素を渡すようになりました。

 ![チャットメッセージUIと表示されているHTML構造。(AIによるキャプション)](https://global.discourse-cdn.com/meta/original/4X/3/c/0/3c071b64ae3eb9acae48a62ef62307b744425e38.png)

画像が `chat-message-collapser-body` の中に定義されているため、lightbox はここで画像を見つけることができません。

変更はこちらで導入されました: [DEV: Refactor chat HTML decorating (#31309) · discourse/discourse@a0f681b · GitHub](https://github.com/discourse/discourse/commit/a0f681b2561620c52ac8ad4d8165e03944805591)

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2025 年 2 月 20 日午前 8:25 UTC](https://meta.discourse.org/t/images-in-an-enlarged-chat-cannot-be-opened-after-a-message-with-the-image-is-posted/352881/6 "2025-02-20T08:25:37Z")

</div>

はい、見えないとのこと、申し訳ありません。ささやきですが、すでに@davidさんにピングしました。これも最近の変更に関連していると思います。

確認していただきありがとうございます。まだ自分の理論を証明する時間がありませんでした👍

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2025 年 2 月 20 日午前 10:09 UTC](https://meta.discourse.org/t/images-in-an-enlarged-chat-cannot-be-opened-after-a-message-with-the-image-is-posted/352881/8 "2025-02-20T10:09:37Z")

</div>

@meglio、@Arkshine、ありがとうございます！

通常の「デコレートクック」をメッセージコンテンツのみに限定するのは意図的です。しかし、画像を処理するための特定のライトボックスロジックを追加しました。元の画像が最適化されたバージョンに置き換えられた場合のケースを処理していなかったようです。

修正はこちら：

> <https://github.com/discourse/discourse/pull/31414>
>
> When a message is first sent, the original upload URL is used for a split-second… before it's replaced by the optimised thumbnail. Using \`didInsert\` didn't re-run on any changes to the uploads. Switching to a proper modifier, and checking the length of the uploads array within it, will ensure that it is re-run whenever the uploads change.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2025 年 2 月 21 日午前 8:00 UTC](https://meta.discourse.org/t/images-in-an-enlarged-chat-cannot-be-opened-after-a-message-with-the-image-is-posted/352881/9 "2025-02-21T08:00:02Z")

</div>

このトピックは21時間後に自動的にクローズされました。返信はもうできません。
