Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use default values when settings aren't in the database #15

Closed
therealsujitk opened this issue Aug 5, 2021 · 0 comments · Fixed by #18
Closed

Use default values when settings aren't in the database #15

therealsujitk opened this issue Aug 5, 2021 · 0 comments · Fixed by #18
Labels
bug Something isn't working

Comments

@therealsujitk
Copy link
Owner

therealsujitk commented Aug 5, 2021

Flarum only saves settings in the database that have been changed, hence the default values aren't saved in the database. When settings aren't saved in the database, a default value needs to be used in the oninit() function. For example

this.engine = app.forum.attribute(`${prefix}.engine`);

needs to be changed to

this.engine = app.forum.attribute(`${prefix}.engine`) || 'giphy';

Temporary Fix

Simply change the setting in the admin panel to a different value and save it so that Flarum understands a change has been made and needs to be updated. You can change it back to it's previous value and save it again.

@therealsujitk therealsujitk added the bug Something isn't working label Aug 5, 2021
imorland added a commit to imorland/flarum-ext-gifs that referenced this issue Sep 8, 2021
@therealsujitk therealsujitk linked a pull request Sep 8, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant