The old float validation had several bugs. It will recognize strings
like "a1.2" and "3.4b" as valid doubles, but will not recognize integers
like "1234" as doubles. Also, since an empty string is not falsy in Ruby,
it will recognize "Inf" as -Infinity.
This commit fixes these issues
Validation of `user_id` parameter will throw a 500 error because
`User.find_by_username_or_email` does not throw
`ActiveRecord::RecordNotFound`, but silently returns `nil`.
This results in a `NoMethodError` in `object.id` on the next line
What's the problem?
===================
TL;DR: When the user enters an incorrect default value, its
corresponding param-input will disappear
When creating a parameter from SQL, we perform cast_to_ruby, which means
that if the default value given by the user is invalid, the entire
parameter will not be added to the param_list of the query.
This behavior is very confusing, and users will not understand why an
incorrect initial value will cause the param-input to disappear.
What's the fix?
================
The cast_to_ruby process is canceled in create_from_sql, so that
param-input with incorrect default value will still be displayed.
We have a simple validation process on the front end, which is enough to
prompt whether some default inputs are incorrect.
The `onSubmit` hook will only be triggered when the form is valid, so we
need to clear the contents of `serializedData` in advance in `submit`.
Otherwise, it may not throw a validation error.
We used `with_deleted` incorrectly in the code. This method does not exist
on `User`, `Badge`, and `Group`. This will cause an error when entering a
numeric id in these three parameter input, forcing the user to enter the
name/username of these inputs.
See https://github.com/discourse/discourse-data-explorer/pull/307#issuecomment-2291017256
* FIX: Wrong type in category_id param input
We will dasherize category_id. The dasherize function accepts a string,
but we don't type-check it, so the default null may be passed in. This
will cause a type error and crash the front-end.
What does this fix?
===================
When creating a data explorer query that includes parameters, the
parameter input boxes don’t display until the page is refreshed.
After this commit, when the query is saved, the input boxes will appear.
ref: t/113297
This commit changes the header for the first column of the queries table to have the correct label. Currently it says "Created by", but it should be "Query".
Since 67a8080e33
in core, the functionality to bookmark a report from the group
Reports tab has been broken. This commit fixes the issue and adds
system spec coverage to prevent regression.
The main change here is that we now send a single PM to a group rather than individual PMs to each group member.
This change also adds email recipients correctly as target_emails since support was added within Discourse Automation.
* Added can_see_bookmarkable? methods to BaseBookmarkable, implement
that in QueryGroupBookmarkable
* Update spec to check that Notification for reminder has
bookmarkable_id and bookmarkable_type
c.f. https://github.com/discourse/discourse/pull/25905