# Les clés i18n s'affichent sur la page d'édition des Webhooks

**URL:** <https://meta.discourse.org/t/i18n-keys-showing-on-webhooks-edit-page/297701>\
**Category:** Bug\
**Created:** [Mars 3, 2024, 2:09 UTC](https://meta.discourse.org/t/i18n-keys-showing-on-webhooks-edit-page/297701 "2024-03-03T14:09:41Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [Mars 3, 2024, 3:44 UTC](https://meta.discourse.org/t/i18n-keys-showing-on-webhooks-edit-page/297701/2 "2024-03-03T15:44:23Z")

</div>

Bonne remarque !

Vous ne devriez pas voir le webhook d’un plugin qui n’est pas installé sur votre Discourse.

C’est une régression à partir d’ici :

> <https://github.com/discourse/discourse/commit/c46811092994d456e7a67b33669b76e51aaa3668#diff-2dd34e39ecc3176d116ca671641ae175f4d74db68e0db21f0eea477cdd45b818>
>
> Before this change, webhooks could be only configured for specific groups like f…or example, all topic events.
> 
> We would like to have more granular control like for example topic\_created or topic\_destroyed.
> 
> Test are failing because plugins changed has to be merged as well:
> discourse/discourse-assign#498
> discourse/discourse-solved#248
> discourse/discourse-topic-voting#159

Spécifiquement ici.  
Les symboles fournis dans `TYPES` ne correspondent pas aux valeurs de la liste :

> <https://github.com/discourse/discourse/blob/main/app/models/web_hook_event_type.rb#L72-L75>

> <https://github.com/discourse/discourse/blob/main/app/models/web_hook_event_type.rb#L98-L112>

> **À l'équipe, voici une solution possible :**
>
> ```ruby
> def self.types_with_prefix(prefix)
> TYPES.select { |key, _value| key.to_s.start_with?(prefix.to_s) }.values
> end
> 
> def self.active
> ids_to_exclude = []
> unless defined?(SiteSetting.solved_enabled) && SiteSetting.solved_enabled
> ids_to_exclude.concat(types_with_prefix(:solved))
> end
> unless defined?(SiteSetting.assign_enabled) && SiteSetting.assign_enabled
> ids_to_exclude.concat(types_with_prefix(:assign))
> end
> unless defined?(SiteSetting.voting_enabled) && SiteSetting.voting_enabled
> ids_to_exclude.concat(types_with_prefix(:voting_topic))
> end
> unless defined?(SiteSetting.chat_enabled) && SiteSetting.chat_enabled
> ids_to_exclude.concat(types_with_prefix(:chat_message))
> end
> self.where.not(id: ids_to_exclude.flatten)
> end
> 
> ```

---

_[View the full topic](https://meta.discourse.org/t/i18n-keys-showing-on-webhooks-edit-page/297701)._
