discourse-telegram-notifications icon indicating copy to clipboard operation
discourse-telegram-notifications copied to clipboard

Move Telegram notification option into Notifications section

Open jessicah opened this issue 4 years ago • 3 comments

Should make the setting easier to find in a more obvious place.

jessicah avatar Sep 28 '20 01:09 jessicah

Hmm, I should have tested it more, seems it doesn't actually save the value...

jessicah avatar Sep 28 '20 01:09 jessicah

To make this save correctly, we need to add custom_fields to the values here:

https://github.com/discourse/discourse/blob/46d1c91e1a0fd40110619b85bd2ed1623c70c6d0/app/assets/javascripts/discourse/app/controllers/preferences/notifications.js#L10-L19

This should be possible via the plugin API, using modifyClass to override the init function of the controller, calling super(), then appending custom_fields to this.saveAttrNames.

The reason it worked before is that the Profile tab already has custom_fields in the array:

https://github.com/discourse/discourse/blob/52672b9eabccb1184d85dc7f08062d5a7c18cb73/app/assets/javascripts/discourse/app/controllers/preferences/profile.js#L20

davidtaylorhq avatar Oct 15 '20 12:10 davidtaylorhq

Ah, that explains the difference, so much magic! I'll see if I can plug this all together, thank you :)

jessicah avatar Oct 17 '20 11:10 jessicah