Daniel Waterworth
56c4804440
DEV: Always pass ancestors to category-link ( #26638 )
...
We want to remove uses of Category.findById. This change pushes the fetching up the chain of responsibility.
2024-04-16 15:28:36 -05:00
Daniel Waterworth
cead0cf684
DEV: Remove Category.findById from admin web hooks ( #26605 )
...
Include categories when fetching admin/web_hooks and make
'extras' more useful. 'extras' is the mechanism we use to provide
context for rest objects.
However, previously:
* When you fetched many objects, extras was only set on the ResultSet,
not on each object,
* If you need derived data from extras, there wasn't a sensible place to
put this code. Now, you can create an 'ExtrasClass' static field on
your rest model and this class will be used for your extras data,
2024-04-11 16:11:00 -05:00
Daniel Waterworth
cafdc29806
DEV: Replace Category.findById with Category.asyncFindByIds in easy cases ( #26270 )
2024-04-05 11:59:10 -05:00
Daniel Waterworth
5835d4e5ed
DEV: Make CategoryChooser optionally provide the category ( #26420 )
...
... rather than just the category id.
In order for the user to have selected a category, the category must
have been loaded and it's useful for the category chooser to provide
this fetched category so that it doesn't need to be refetched.
In the future, it would be better to store the categories that the
chooser knows about in local component state, so that the category
doesn't need to be fetched from the id map, but this, at least, puts the
API in place.
2024-03-28 11:16:39 -05:00
Daniel Waterworth
897be75941
FIX: Don't set smtp authentication type when there's no user or password
...
... otherwise net-smtp, starting with 0.5.0, complains.
2024-03-27 14:20:29 -05:00
Daniel Waterworth
cc8f0a79e2
PERF: Replace posts reply_to_post_number index ( #26385 )
...
post_number is a sequence per topic, so it doesn't make sense to have an
index on only reply_to_post_number without also including the topic_id.
2024-03-27 09:56:29 +08:00
Daniel Waterworth
bf35928a14
DEV: Set category on embeddable-host component instead of rest object ( #26374 )
...
The rest object doesn't need the whole serialized category.
2024-03-26 11:16:07 -05:00
Daniel Waterworth
739a139bcf
DEV: Reduce duplication ( #26329 )
2024-03-25 11:56:32 -05:00
Daniel Waterworth
d52abe2324
FIX: Set has_children correctly in Category.preload_user_fields! ( #26327 )
2024-03-22 12:41:28 -05:00
Daniel Waterworth
1fbcc6936c
DEV: Regression test for categories N+1 ( #26204 )
2024-03-15 15:10:37 -05:00
Daniel Waterworth
8cade1e825
SECURITY: Prevent large staff actions causing DoS
...
This commit operates at three levels of abstraction:
1. We want to prevent user history rows from being unbounded in size.
This commit adds rails validations to limit the sizes of columns on
user_histories,
2. However, we don't want to prevent certain actions from being
completed if these columns are too long. In those cases, we truncate
the values that are given and store the truncated versions,
3. For endpoints that perform staff actions, we can further control
what is permitted by explicitly validating the params that are given
before attempting the action,
2024-03-15 14:24:04 +08:00
Daniel Waterworth
819361ba28
SECURITY: Don't disclose the existence of secret subcategories
2024-03-15 14:23:55 +08:00
Daniel Waterworth
f0baa0ddfe
DEV: Prefer defer_get_set over get/set on DistributedCache ( #25967 )
2024-02-29 11:10:24 -06:00
Daniel Waterworth
9db009bf96
DEV: Reorder categories in sidebar edit modal ( #25792 )
...
Sort categories by relevance instead of alphabetically.
2024-02-21 14:35:04 -06:00
Daniel Waterworth
087712c1a6
DEV: Reduce duplication with DistributedMutex#clear_regex ( #25795 )
2024-02-21 14:19:04 -06:00
Daniel Waterworth
bf7470e93b
FIX: Make /categories/search order deterministic ( #25793 )
2024-02-21 12:20:40 -06:00
Daniel Waterworth
13291dc5ef
FIX: Cache keys should be strings ( #25791 )
...
* FIX: Cache keys should be strings
Otherwise, there are subtle bugs that don't show up with a single
process.
2024-02-21 10:55:48 -06:00
Daniel Waterworth
0529d20db4
DEV: Use DistributedCache#defer_get_set instead of getting and setting ( #25778 )
...
We use defer_get_set everywhere else, so for consistency and reducing
complexity, this is better.
2024-02-20 18:29:01 -06:00
Daniel Waterworth
13083d03ae
DEV: Async category search for sidebar modal ( #25686 )
2024-02-20 11:24:30 -06:00
Daniel Waterworth
d1ebca90ff
DEV: Convert sidebar edit navigation modal/categories modal to gjs ( #25662 )
2024-02-13 13:22:31 -06:00
Daniel Waterworth
6311a80724
FIX: Preload associations on subcategories when lazy loading categories ( #25630 )
2024-02-09 11:48:26 -06:00
Daniel Waterworth
250ce25ca3
DEV: Clarify site-setting category-list concurrency protection ( #25614 )
2024-02-09 10:14:00 -06:00
Daniel Waterworth
57c53b0ead
DEV: Do lazy_load_categories check inside asyncFindByIds ( #25600 )
...
This way, we can use asyncFindByIds indiscriminately.
2024-02-07 17:33:59 -06:00
Daniel Waterworth
8058fd5b80
FIX: Add id to warn ( #25597 )
2024-02-07 17:20:08 -06:00
Daniel Waterworth
3da302716c
DEV: Coalesce category ids to numbers ( #25598 )
...
Otherwise, if you pass in strings, strange things happen.
2024-02-07 17:19:58 -06:00
Daniel Waterworth
30922855f2
PERF: Don't allow a single user to monopolize the defer queue ( #25593 )
2024-02-07 13:47:50 -06:00
Daniel Waterworth
67229a7739
DEV: switch to asyncFindByIds in category-list site-setting component ( #25592 )
...
We no longer want to rely on preloading every single category, which
means we need to do http requests for categories when we need them.
2024-02-07 12:07:32 -06:00
Daniel Waterworth
8561fd78d8
DEV: Convert site-settings/category-list to glimmer component ( #25571 )
2024-02-05 14:23:08 -06:00
Daniel Waterworth
a20bf843fc
DEV: Switch site-settings category-list component to gjs ( #25569 )
2024-02-05 12:03:35 -06:00
Daniel Waterworth
5f06d6490d
PERF: Add cache for Category.asyncFindByIds ( #25531 )
...
This way, we don't fetch the same category multiple times.
2024-02-02 14:13:12 -06:00
Daniel Waterworth
30bea5c7c2
FIX: Don't use joins to filter ( #24904 )
...
Posts may have multiple uploads/upload references.
2024-01-11 16:11:29 +11:00
Daniel Waterworth
50911b2579
add tests
2024-01-08 08:02:18 -07:00
Daniel Waterworth
75c645453d
SECURITY: Store custom field values according to their registered type
2024-01-08 08:02:17 -07:00
Daniel Waterworth
4494d62531
SECURITY: Run custom field validations with save_custom_fields
2024-01-08 08:02:16 -07:00
Daniel Waterworth
d7a09fb08d
DEV: Add true_fields method for CustomFields ( #24876 )
...
This is useful for plugins that might otherwise rely on the
CUSTOM_FIELD_TRUE constant.
2023-12-14 11:06:21 -06:00
Daniel Waterworth
f7aefffea7
DEV: Concerns can use class_methods ( #24875 )
2023-12-13 14:12:03 -06:00
Daniel Waterworth
611acaa6bc
FIX: Validate each value in an array custom field separately ( #24659 )
2023-12-07 14:24:04 -06:00
Daniel Waterworth
a6c79aa27a
DEV: Fix readonly admin login spec ( #24714 )
...
"prevents login by admins" should test with an admin.
2023-12-05 06:49:22 -06:00
Daniel Waterworth
434ae5bbe7
FIX: Allow setting an array custom field to a singleton value ( #24636 )
...
Also, validation happens per item in an array field.
2023-11-29 14:18:47 -06:00
Daniel Waterworth
eef93ac926
DEV: Allow setting max_length for field types using the plugin API ( #24635 )
2023-11-29 14:17:12 -06:00
Daniel Waterworth
6aa69bdaea
DEV: Allow setting different custom field length limits by key ( #24505 )
2023-11-22 12:00:42 -06:00
Daniel Waterworth
38abd471b6
DEV: Remove unnecessary fab! block ( #24496 )
2023-11-21 17:03:17 -06:00
Daniel Waterworth
0059e6807c
DEV: Refactor save_custom_fields methods ( #24495 )
...
Operate a key at a time, to make it clearer what's going on.
This also fixes a bug where array integer fields would get re-written
even when there wasn't a change.
2023-11-21 12:40:15 -06:00
Daniel Waterworth
ced21fa5c1
DEV: Deprecate array custom fields ( #24492 )
...
Array custom fields use separate rows for each value, but whenever we
update an array, we have always destroy the existing rows and create new
ones. Therefore, there's no benefit over using the json type.
2023-11-21 11:05:49 -06:00
Daniel Waterworth
b3c67a78b8
FIX: Preserve custom field array order ( #24491 )
2023-11-21 10:55:22 -06:00
Daniel Waterworth
0c712eaa3a
DEV: Don't define methods in an included block ( #24433 )
2023-11-17 12:22:32 -06:00
Daniel Waterworth
e34d2cfde4
DEV: Remove unnecessary fab! blocks ( #24419 )
2023-11-16 13:22:08 -05:00
Daniel Waterworth
46e2523177
DEV: Remove custom field regexes ( #24390 )
...
As far as I can tell, this isn't used
2023-11-16 11:37:10 -06:00
Daniel Waterworth
0bc568f66d
FIX: Preload the right fields on categories ( #24396 )
2023-11-15 16:34:03 -06:00
Daniel Waterworth
e845138bc1
FIX: Updating presence status in readonly mode should fail gracefully ( #24333 )
2023-11-10 14:27:43 -06:00
Daniel Waterworth
6e161d3e75
DEV: Allow fab! without block ( #24314 )
...
The most common thing that we do with fab! is:
fab!(:thing) { Fabricate(:thing) }
This commit adds a shorthand for this which is just simply:
fab!(:thing)
i.e. If you omit the block, then, by default, you'll get a `Fabricate`d object using the fabricator of the same name.
2023-11-09 16:47:59 -06:00
Daniel Waterworth
5c92d7da22
FIX: Increase defer queue length ( #24200 )
...
It's important that there is a limit, but the current limit is too
restrictive.
2023-11-01 14:02:53 -05:00
Daniel Waterworth and Penar Musaraj
290306a932
SECURITY: Reduce maximum size of SVG sprite cache to prevent DoS
...
Co-authored-by: Penar Musaraj <pmusaraj@gmail.com >
2023-09-12 15:31:28 -03:00
Daniel Waterworth
40acb9a111
DEV: Run core system tests by default in docker test image ( #23517 )
2023-09-11 16:04:33 -05:00
Daniel Waterworth
70d082584c
DEV: Allow explicitly enabling/disabling system tests in bin/turbo_rspec ( #23515 )
...
This doesn't alter the default behavior.
2023-09-11 13:11:06 -05:00
Daniel Waterworth
82a56334a3
PERF: Cache each theme field value once ( #23192 )
...
Previously, theme fields from components would be cached for each of
their parent themes.
2023-08-31 11:24:02 -05:00
Daniel Waterworth
91f560a521
DEV: Make every DistributedCache lazily instantiated ( #23147 )
2023-08-18 10:59:11 -05:00
Daniel Waterworth
80a0d88e4c
FIX: Ensure javascript caches are unique per theme/theme_field ( #23126 )
...
We were assuming that this was the case before, but not enforcing it.
2023-08-17 13:57:04 -05:00
Daniel Waterworth
50d527b80c
DEV: Remove db_timeout setting ( #22912 )
...
It doesn't actually do anything.
2023-08-01 14:17:43 -05:00
Daniel Waterworth
26e267478d
SECURITY: Don't allow a particular site to monopolize the defer queue
2023-07-28 12:53:51 +01:00
Daniel Waterworth
b7404373cf
FIX: Always clear caches after committing the current transaction ( #22550 )
...
Instead of having to remember every time, just always wait until the
current transaction (if it exists) has committed before clearing any
DistributedCache.
The only exception to this is caches that aren't caching things from
postgres.
This means we have to do the test setup after setting the test
transaction, because doing the test setup involves clearing caches.
Reapplying this - it now doesn't use after_commit if skip_db is set
2023-07-12 09:49:28 -05:00
Daniel Waterworth
cb794275a7
Revert "FIX: Always clear caches after committing the current transaction" ( #22493 )
...
This reverts commit 8310c7842c .
This was breaking precompilation.
2023-07-07 18:05:38 -05:00
Daniel Waterworth
9dd01ca2ef
FIX: Always clear caches after committing the current transaction ( #22491 )
...
Instead of having to remember every time, just always wait until the
current transaction (if it exists) has committed before clearing any
DistributedCache.
The only exception to this is caches that aren't caching things from
postgres.
This means we have to do the test setup after setting the test
transaction, because doing the test setup involves clearing caches.
2023-07-07 14:24:56 -05:00
Daniel Waterworth
5e2edeb2f7
FIX: Set test transaction to before_all transaction ( #22445 )
...
So that after_commit hooks work correctly for pre-fabricated objects.
2023-07-06 12:23:28 -05:00
Daniel Waterworth
6f8056572e
DEV: Refactor updating parent/child relationships between themes ( #22244 )
...
The prior add_relative_themes! method was confusing and cleared the
cache repeatedly instead of once for the whole operation.
2023-06-22 13:57:39 -05:00
Daniel Waterworth
50bded7b47
FIX: Force ordering to make things more consistent and fix flaky test ( #22228 )
2023-06-21 13:16:10 -05:00
Daniel Waterworth
0cec84206e
DEV: Fix interactions between tests via plugin svg sprite cache ( #22047 )
2023-06-09 13:53:21 -05:00
Daniel Waterworth
67afd85aae
Revert "DEV: Use runtime info to split test files for parallel testing ( #21896 )" ( #22016 )
...
This reverts commit 14ed971db6 .
This prevented the core backend tests from running in GitHub CI
2023-06-08 15:13:26 -05:00
Daniel Waterworth
3d3e8c8fbd
FIX: json_schemer no longer allows nil keys ( #22015 )
2023-06-08 15:12:47 -05:00
Daniel Waterworth
353c8ea51f
DEV: Don't pass in extra, ignored parameters when rendering sass ( #21591 )
...
As far as I can tell, these parameters do nothing.
2023-05-16 12:14:06 -05:00
Daniel Waterworth
53d99d1a26
DEV: Skip flaky tests ( #21534 )
2023-05-15 07:51:25 +02:00
Daniel Waterworth and Penar Musaraj
0a96579cef
DEV: Allow site setting errors to be displayed as html if they are safe ( #21342 )
...
This is only useful for plugins currently
Co-authored-by: Penar Musaraj <pmusaraj@gmail.com >
2023-05-04 15:01:19 -05:00
Daniel Waterworth
bc236119d3
DEV: Increase docker.rake system test timeout time to match CI ( #21339 )
2023-05-02 12:12:03 -05:00
Daniel Waterworth
a4dd758f5c
DEV: Add 20m timeout to system tests ( #21323 )
2023-05-01 13:23:48 -05:00
Daniel Waterworth
ae63d9ea09
PERF: Remove unnecessary queries from Theme#set_field ( #21281 )
2023-04-27 13:04:58 -05:00
Daniel Waterworth
38cebd3ed5
Revert "FEATURE: Better thread reply counter cache ( #21108 )" ( #21192 )
...
This reverts commit 180e3e11d1 .
Per internal discussions, this is a temporary revert, to investigate if this is causing a performance regression.
2023-04-20 15:09:47 -05:00
Daniel Waterworth
a4d51810e2
DEV: Correct ambiguous name ( #21189 )
...
This file would do different things depending on whether
Migration::Migration existed beforehand.
2023-04-20 11:28:08 -05:00
Daniel Waterworth
c68497159f
FIX: Use string for postgres recently readonly DistributedCache ( #21040 )
...
Since DistributedCaches don't marshal timestamps
2023-04-10 13:54:55 -05:00
Daniel Waterworth
fcc73b441d
FIX: Make emoji cache store marshalled objects ( #21029 )
...
We only marshal arrays, hashes and sets, which meant that the emojis
here were just getting `to_s`ed.
This is a hack.
2023-04-10 10:44:11 -05:00
Daniel Waterworth
0ff86feb96
DEV: Rely on helpers for ajax error handling to reduce repetition ( #20988 )
2023-04-06 11:25:24 -05:00
Daniel Waterworth
355b44472b
DEV: Allow HTML errors whenever a popup is generated ( #20989 )
...
Follow-up-to: 6bbf832400
2023-04-06 10:00:54 -05:00
Daniel Waterworth
cd6d47e012
FIX: Handle errors when we show the edit user directory columns modal ( #20986 )
2023-04-05 14:31:32 -05:00
Daniel Waterworth
79c87b5003
FIX: Show better default error when failing to delete all user posts ( #20985 )
2023-04-05 14:26:00 -05:00
Daniel Waterworth
852475dca4
DEV: Add yarn-app shim to run yarn using the app modules ( #20983 )
2023-04-05 13:12:58 -05:00
Daniel Waterworth
2df0eca39a
DEV: Make postgres_readonly cache work like other caches ( #20879 )
...
We didn't have an authoritative source for this data previously, so now
it's stored in redis.
2023-03-30 09:14:59 -05:00
Daniel Waterworth
d563b73202
DEV: Make category topic_ids cache work like other caches ( #20814 )
2023-03-27 09:23:29 -05:00
Daniel Waterworth
3e80ab3143
DEV: Make category subcategory_ids cache work like other caches ( #20815 )
2023-03-27 09:23:23 -05:00
Daniel Waterworth
b2554e1490
DEV: Make hex cache work like other caches ( #20816 )
2023-03-27 09:22:53 -05:00
Daniel Waterworth
9d34b73a5e
DEV: Make csp cache work like other caches ( #20818 )
2023-03-27 09:22:38 -05:00
Daniel Waterworth
0f4bb19524
DEV: make developer cache work like other caches ( #20817 )
2023-03-27 09:22:33 -05:00
Daniel Waterworth
0728fa055b
DEV: Make theme cache work like other caches ( #20813 )
2023-03-24 12:37:16 -05:00
Daniel Waterworth
7e23e6c1e8
DEV: Make banner cache work like other caches ( #20811 )
2023-03-24 12:36:55 -05:00
Daniel Waterworth
bc8ab33708
DEV: Disable test to see if this is what's causing ci failures ( #20809 )
2023-03-24 11:15:30 -05:00
Daniel Waterworth
52999d1422
DEV: Show which system tests are being executed in CI ( #20795 )
...
... to see if it's always the same test causing timeouts
2023-03-23 15:12:14 -05:00
Daniel Waterworth
7b01576c8d
DEV: Remove emoji cache dead code ( #20764 )
...
The cache is already not shared between app servers that have different
app_versions, so this check was redundant.
2023-03-21 12:33:12 -05:00
Daniel Waterworth
a0a6f6d71b
FIX: Fix the emoji toned regexes ( #20763 )
2023-03-21 11:48:55 -05:00
Daniel Waterworth
da0d20d4a9
DEV: Refactor svg sprite parsing ( #20727 )
...
There was a lot of duplication in the svg parsing and coercion code. This reduces that duplication and causes svg sprite parsing to happen earlier so that more computation is cached.
2023-03-20 11:41:23 -05:00
Daniel Waterworth
293cb7bde2
FIX: An ember build is required to run the system tests ( #20725 )
2023-03-17 13:20:49 -05:00
Daniel Waterworth
164b60cd07
DEV: Optionally, run system tests in docker:test
2023-03-15 16:46:48 -05:00
Daniel Waterworth
5324216740
DEV: Use rspec instead of turbo_rspec with one core
2023-03-15 16:46:48 -05:00