Allow adding custom preferences to user notifications. (PR #10753)

No test, as wasn’t able to locate an existing one for the extension point in profile.hbs.

Goal is to be able to move user preference for discourse-telegram-notifications from Profile section into Notifications section. The existing extension point doesn’t result in the preference being saved.

GitHub

Could you use the user-preferences-notifications plugin outlet, which is a couple of lines above this change? I think it should provide all the info you need, but we can certainly add some more info if needed!

As I mentioned, the existing extension point, user-preferences-notifications doesn’t result in the preference being saved. This PR matches the same extension points in profile.hbs which has one with the “save” and one without, which appears to be significant in extension behaviour.

Passing the save action into the outlet shouldn’t have any impact on whether the preference is saved or not. Note that the actions travel ‘up’ the component tree, so passing the action in allows the outlet to trigger save. It doesn’t allow the component to perform an activity on save.

Please can you open a topic on Meta with some example code demonstrating the issue? I’m sure we can work out how to make it work with the existing outlet.

It was literally this PR, https://github.com/davidtaylorhq/discourse-telegram-notifications/pull/15, that failed to update the preference when I installed it. The app would remember it as a client-side preference until I manually refreshed the page, then it would revert to the value stored in the database.

Ah yes, I remember that PR now. Sorry I didn’t make the connection sooner!

Have you confirmed that using this new outlet fixes the problem?

I haven’t, I had issues deploying a docker instance, probably from trying to test on top of master, and my home server doesn’t have much headroom for running more than one instance :-/

I took a look at this - the reason it doesn’t save is not because of the save action in the plugin outlet. Let’s close this PR, and continue in https://github.com/davidtaylorhq/discourse-telegram-notifications/pull/15