It’s impossible to add “-1” value as it doesnt register “-”.
1 Like
I can repro this. There was a similar issue with another setting the other day. Let me see if I can get someone to take a look.
It looks like the issue was introduced here:
discourse:main
← discourse:dev/integer-site-setting-fields
opened 02:48PM - 06 Oct 23 UTC
### What is this change?
Currently, if you set an integer site setting in the… admin interface and include thousands separators, you will silently configure the wrong value.
**Example:**
```
1,000 == 1
1.000 == 1
1 000 == 1
```
This PR replaces `TextField` inputs for integer site settings with `NumberField`.
It also cleans the numeric input of any non-digits in the backend in case any separators make it through.
### Not in this PR
- The actual value that is set in the back-end is not sent back to the front-end. We probably should.
- We should probably change the latter to use [native number input](https://caniuse.com/input-number) in a separate PR.
- The `SiteSettingsController#update` method is pretty big. I'm considering extracting the logic into a Ruby object that can be tested in isolation, but not in this PR.
And it’s probably related to not providing @min=
here:
Tested this and seems to be problem with text input for desktop, for some reason typing “-” won’t write in to those settings, but works fine on mobile app and for desktop can simply copy/paste “-1” in for that setting and works then.
I used 0 and that worked as well.
Well if the setting is at zero, does this mean accounts can still be self-deleted as long as there are no posts? Negative one is different than zero.
Yes, after I used “0” it disabled the self-service account deletion for all users.
For me there is still an option for a user to delete their account if they have not published any posts when that setting is set to zero.
I just now created a dummy user account, with zero posts and the delete my account is visible with value “0”.
After I created one post from the dummy account, i had to log out and in, then the delete my account disappeared. So, yes we need the ability to insert “-1” to disable the self-service account deletion for all users including the users with 0 posts.
1 Like
martin
(Martin Brennan)
November 16, 2023, 2:12am
13
The fix for this will be here, should be merged later today:
discourse:main
← discourse:dev/fix-min-max-for-number-field
opened 02:08AM - 16 Nov 23 UTC
When we started using NumberField for integer site settings
in e113eff6634c9b39… 8b0541ea6a0d1626f6732dcc, we did not end up
passing down a min/max value for the integer to the field, which
meant that for some fields where negative numbers were allowed
we were not accepting that as valid input.
This commit passes down the min/max options from the server for
integer settings then in turn passes them down to NumberField.
c.f. https://meta.discourse.org/t/delete-user-self-max-post-count-not-accepting-1-to-disable/285162
4 Likes
This topic was automatically closed after 2 days. New replies are no longer allowed.