mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-23 21:01:23 +00:00
ffb94fde85
* Adding local site settings to reject federated upvotes or downvotes. - Should help defend against downvote spamming instances. - Fixes #4086 * Adding new vote mode types. * Simpler activitypub vote check. * Adding undo vote for failed vote mode check. * Update crates/api_common/src/utils.rs --------- Co-authored-by: Nutomic <me@nutomic.com>
31 lines
691 B
SQL
31 lines
691 B
SQL
-- Add back the enable_downvotes column
|
|
ALTER TABLE local_site
|
|
ADD COLUMN enable_downvotes boolean DEFAULT TRUE NOT NULL;
|
|
|
|
-- regenerate their values (from post_downvotes alone)
|
|
WITH subquery AS (
|
|
SELECT
|
|
post_downvotes,
|
|
CASE WHEN post_downvotes = 'Disable'::federation_mode_enum THEN
|
|
FALSE
|
|
ELSE
|
|
TRUE
|
|
END
|
|
FROM
|
|
local_site)
|
|
UPDATE
|
|
local_site
|
|
SET
|
|
enable_downvotes = subquery.case
|
|
FROM
|
|
subquery;
|
|
|
|
-- Drop the new columns
|
|
ALTER TABLE local_site
|
|
DROP COLUMN post_upvotes,
|
|
DROP COLUMN post_downvotes,
|
|
DROP COLUMN comment_upvotes,
|
|
DROP COLUMN comment_downvotes;
|
|
|
|
DROP TYPE federation_mode_enum;
|
|
|