]> cat aescling's git repositories - mastodon.git/commit
Improve account counters handling (#15913)
authorClaire <claire.github-309c@sitedethib.com>
Fri, 19 Mar 2021 12:14:57 +0000 (13:14 +0100)
committerGitHub <noreply@github.com>
Fri, 19 Mar 2021 12:14:57 +0000 (13:14 +0100)
commit741d0952b174740e70a09fe6db6862624dfe1e44
treef7869ec70cf7ba04678bfc00f1032ae34228f5fa
parentc31c95ffe4fbf80981a0ee03484d72ee6d75d2ee
Improve account counters handling (#15913)

* Improve account counters handling

* Use ActiveRecord::Base::sanitize_sql to pass values instead of interpolating them

Keep using string interpolation for `key` as it is safe and using
“ActiveRecord::Base::sanitize_sql_hash_for_assignment” would require stitching
bits of SQL in a way that is not more easily checked for safety.

* Add migration hook to catch PostgreSQL versions earlier than 9.5
app/models/account_stat.rb
app/models/concerns/account_counters.rb
lib/tasks/db.rake
spec/models/account_stat_spec.rb [deleted file]
spec/models/concerns/account_counters_spec.rb [new file with mode: 0644]