discourse-nationalflags
discourse-nationalflags copied to clipboard
DEV: assigns flags to user when new users are created and rake task to assign flags to existing users
In this PR I have added 2 features:
- All new users will be assigned a flag based on their IP address which can be changed by them from user preferences.
- A rake task to assign flags to all existing users, but to use this rake task owner needs to purchase a license of abstractapi.com. I had to add this because the gem geocoder has some API calling restrictions due to which we had to purchase the license. It costs around 9$ and is required only for single time usage.
Thanks for the PR! Is it necessary to include all the gem files like this? Isn’t there some kind of gemspec file? (It’s been too long since I worked with ruby!) @merefield id like to ask you to review this as and when you have the time. :)
Hi @Ebsy I have removed all the gem files from the PR
@Ahmedgagan it was me who requested that and thanks.
So please correct me if I'm wrong, but this adds a rake task that is optional and can be run on the console if the admin wishes?
Otherwise there is no change to the current behaviour?
Hi @merefield There's another change where all the users will be assigned a flag based on their IP address when they will create an account on the forum
@Ahmedgagan ah, the code clean-up helped hide that (we should probably consider separate PRs for code clean-up or diffs get harder to inspect)
ok I'd strongly recommend that's made a global option default OFF in the settings, so we aren't introducing undesired functionality upon merge/update. Some admins may not want that to be automated.
Also note that Nationality is in general a little sensitive. E.g. you might be a Ukrainian living in the UK and like to appear as Ukrainian, not British so an automated solution has its downsides. Does the user at least have the capability to change it during the sign-up process?
@merefield Sorry for mixing the code cleanup.
Yes, I agree with you for adding a site setting to disable this feature.
I totally agree with you about how sensitive this feature might be. I made this feature on a paid request and the sponsor wanted me to make a PR.
Ill add a setting to disable this by today.
Thanks for your time mate.
@Ahmedgagan no problem and thanks for the code cleanup, just a suggestion (and note to self) as probably good practice.
It's a much welcomed feature, I'm sure, so thank you, just need to consider those additional things.
Optimally if the user sees the automated default from IP and can change it during the sign-up process, and we add a global switch that would be good enough imho.
Perhaps @Ebsy has some additional thoughts ...
Thanks @merefield agree with absolutely everything you’ve said.
Allowing the plug-in to suggest a national flag when user signs up is fine but we need to allow the user to override that. A location is, of course, not necessarily a user’s nationality. VPNs can also skew this.
I’m not sure how much additional work is needed to add this functionality so a default “global off” setting for this and the rake task would be the minimum.
@Ahmedgagan How does the rake task work for users that already have a flag set?
additionally with the added cost of the api license for the rake task, I’d ask that this be added to the readme/added to the global switch.
@Ahmedgagan did you progress with the feedback any?