# トピックあたりの max tags が失敗しても静かに無視される

**URL:** https://meta.discourse.org/t/max-tags-per-topic-failing-silently/142241
**Category:** Bug
**Tags:** tags
**Created:** [2020 年 2 月 21 日午前 9:52 UTC](https://meta.discourse.org/t/max-tags-per-topic-failing-silently/142241 "2020-02-21T09:52:01Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![bartv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bartv/32/130052_2.png) [@bartv](https://meta.discourse.org/u/bartv)
#### Post date: [2020 年 2 月 21 日午前 9:52 UTC](https://meta.discourse.org/t/max-tags-per-topic-failing-silently/142241/1 "2020-02-21T09:52:01Z")

</div>

今週から、トピックに `max tags per topic` を超えるタグを追加しても、エラーメッセージは表示されなくなりました。代わりに、トピックは保存されますが、超過したタグは静かに破棄されます。

---

<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: [2020 年 2 月 21 日午前 10:53 UTC](https://meta.discourse.org/t/max-tags-per-topic-failing-silently/142241/3 "2020-02-21T10:53:42Z")

</div>

こんにちは、

以下のプルリクエストで修正されています。

> <https://github.com/discourse/discourse/pull/9018>

いくつかのテストを追加しましたので、これで再び同様の問題が発生しないことを願っています。

ありがとうございます。

---

<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: [2020 年 2 月 21 日午前 11:36 UTC](https://meta.discourse.org/t/max-tags-per-topic-failing-silently/142241/4 "2020-02-21T11:36:11Z")

</div>

マージ済み

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2024 年 2 月 13 日午後 1:28 UTC](https://meta.discourse.org/t/max-tags-per-topic-failing-silently/142241/5 "2024-02-13T13:28:55Z")

</div>



---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2024 年 2 月 13 日午後 1:47 UTC](https://meta.discourse.org/t/max-tags-per-topic-failing-silently/142241/6 "2024-02-13T13:47:12Z")

</div>

`max_tags_per_topic` が現在の `tests-passed` で 0 に設定されている場合にサイレントに失敗することについて報告したいと思い、このトピックを見つけました。

再現手順:

- `max_tags_per_topic` を 0 に設定します。
- トピックにタグを追加します。
- タグが追加されていないことを確認します。

`max_tags_per_topic` が 1 に設定されており、2 番目のタグを追加しようとすると、「1 つしか選択できません」というエラーメッセージが表示されます。

バグはここにあると推測されます: [https://github.com/discourse/discourse/commit/6bee972a5cebf9dccdf969f2936351cb23c641c6#diff-332f59f52705c2ca37ec4509fee6162024b4f97b8451c5c321de30d05661d127R87](https://github.com/discourse/discourse/commit/6bee972a5cebf9dccdf969f2936351cb23c641c6#diff-332f59f52705c2ca37ec4509fee6162024b4f97b8451c5c321de30d05661d127R87) 。`maximum` が 0 の場合、`if` 式は false になります。

---

<div class="post-metadata">

### Author: ![nat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nat/32/235063_2.png) [@nat](https://meta.discourse.org/u/nat)
#### Post date: [2024 年 3 月 19 日午前 4:50 UTC](https://meta.discourse.org/t/max-tags-per-topic-failing-silently/142241/8 "2024-03-19T04:50:04Z")

</div>

ありがとうございます。こちらで修正しました。

> <https://github.com/discourse/discourse/pull/26233>
>
> Currently when \`max\_tags\_per\_topic\` is zero, it fails silently. 
> 
> This change …highlights the limit below the tag picker, and also prevents search when max is 0. It continues to allow users to remove existing tags if the max is changed to 0.
> 
> I considered removing the tag picker when the value is 0 and there are no existing tags, but it becomes non-obvious to the user why the tag picker is gone. So showing the red 'error' provides a better clue. Language-wise it sounds a bit funny, but after thinking a bit, I think it works alright.
> 
> Related: https://meta.discourse.org/t/max-tags-per-topic-failing-silently/142241
> 
> Some screenshots
> 
> \### Existing tag, but max changed to 0
> \<img width="459" alt="Screenshot 2024-03-19 at 12 04 42 PM" src="https://github.com/discourse/discourse/assets/1555215/1174a518-6f8e-47d9-8f16-52480629087e"\>
> 
> \### Composer
> \<img width="767" alt="Screenshot 2024-03-19 at 12 05 16 PM" src="https://github.com/discourse/discourse/assets/1555215/54f1bbc2-0e4b-46c1-b345-af9a367859b7"\>
> 
> \### Topic tag picker when 0 tags doesn't search
> \<img width="764" alt="Screenshot 2024-03-19 at 12 10 46 PM" src="https://github.com/discourse/discourse/assets/1555215/f9a2ea1d-3351-4d31-840b-3abe09cd8a24"\>

---

<div class="post-metadata">

### Author: ![nat](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nat/32/235063_2.png) [@nat](https://meta.discourse.org/u/nat)
#### Post date: [2024 年 3 月 20 日午前 12:00 UTC](https://meta.discourse.org/t/max-tags-per-topic-failing-silently/142241/9 "2024-03-20T00:00:00Z")

</div>

このトピックは19時間後に自動的に閉じられました。返信はもうできません。
