docbrown/app
Daniel Uber 71df6eaddf
Only check cache or database once (#13010)
* Only check cache or database once

Since `@trusted` is a boolean true/false value, we can't use the
`@ivar || value` pattern, and want instead to check if the variable
has been defined.

Fixes #13006

* Add unit test around memoization behavior

In local testing I was able to get this to fail by changing the
2.times block to include `remove_instance_variable(:@trusted)` (so the
`allow...once` check is sufficient to ensure we are not calling the
cache more than once per instance when false).
2021-03-16 18:58:57 -05:00
..
assets Revert "Removed service worker (#12974)" (#13014) 2021-03-16 18:10:01 -05:00
black_box
controllers Revert "Removed service worker (#12974)" (#13014) 2021-03-16 18:10:01 -05:00
decorators Publicly indicate if someone edits their comments (#10524) 2021-03-02 09:47:25 +07:00
errors Prevent suspended users from self-deleting and returning (#12503) 2021-02-11 09:28:59 +07:00
helpers Revert "Removed service worker (#12974)" (#13014) 2021-03-16 18:10:01 -05:00
javascript Turned off deprecated rule in jsx-a11y eslint plugin. (#12986) 2021-03-16 12:36:16 +01:00
lib Revert "Removed service worker (#12974)" (#13014) 2021-03-16 18:10:01 -05:00
liquid_tags improve keyboard accessibility of modals 12427 10610 (#12511) 2021-02-24 16:01:10 +00:00
mailers Email confirmation to abuse reports (#12557) 2021-02-03 22:59:50 +03:00
middlewares Move TimeZoneSetter middleware in proper place (#11336) 2020-11-09 17:11:10 +01:00
models Only check cache or database once (#13010) 2021-03-16 18:58:57 -05:00
policies Prevent banned users from using API (#12730) 2021-02-18 17:56:16 -05:00
queries/admin Filter by a few other roles when adding potential mods (#11187) 2020-11-02 15:05:19 -05:00
refinements Drop profile columns from user (#10707) 2020-12-03 08:14:38 +07:00
sanitizers Video max width (#12436) 2021-01-26 15:12:37 +01:00
serializers Remove language settings (#12502) 2021-02-04 08:35:00 +07:00
services reenable article rescoring when moderators flag users (#12983) 2021-03-16 14:04:13 -05:00
uploaders Bump carrierwave from 2.1.1 to 2.2.0 (#12802) 2021-02-25 10:53:25 +01:00
validators Add validations to SiteConfig model (#12341) 2021-01-26 09:12:24 +07:00
view_objects Move GeneratedImage to Images::GenerateSocialmage (#11691) 2020-12-02 11:03:14 +07:00
views Revert "Removed service worker (#12974)" (#13014) 2021-03-16 18:10:01 -05:00
workers reenable article rescoring when moderators flag users (#12983) 2021-03-16 14:04:13 -05:00