Add controversial ranking (#3205)
authorPavlos Smith <57727226+iByteABit256@users.noreply.github.com>
Wed, 26 Jul 2023 17:07:05 +0000 (20:07 +0300)
committerGitHub <noreply@github.com>
Wed, 26 Jul 2023 17:07:05 +0000 (13:07 -0400)
commitc890797b370417b9479186acd86bc065693f8691
tree78f5bea63a74041f11dfd83be4ae6b960bb234d2
parentdc4572460e8458753907dc9659bdd015e2f7bb27
Add controversial ranking (#3205)

* Added controversy rank property to posts and comments, and ability to sort by it

* Triggers instead of schedules tasks, integer -> double, TODO: comments don't seem to get updated with floats, divide SortTypes

* Created PersonSortType

* PersonSortType::MostComments case

* Removed unused PartialOrd trait

* Added new person sort type mappings

* SortType -> PersonSortType

* fixes

* cargo fmt

* fixes after merge with main

* Fixed bug in controversy rank trigger, removed TopX sorts from PersonSortType and added CommentScore instead

* Uncovered enum case

* clippy

* reset translation changes

* translations

* translations

* Added additional hot ordering on controversial posts and comments

* featured local and featured community added to controversy rank index, additional order_by removed (?), added post_score and post_count to PersonSortType

* Woodpecker rerun

* cargo fmt

* woodpecker rerun

* fixed controversy_rank order

* fix

* Readded migration as latest, removed second update statement for setting controversy rank
17 files changed:
crates/apub/src/api/search.rs
crates/db_schema/src/aggregates/structs.rs
crates/db_schema/src/lib.rs
crates/db_schema/src/schema.rs
crates/db_schema/src/utils.rs
crates/db_views/src/comment_report_view.rs
crates/db_views/src/comment_view.rs
crates/db_views/src/post_report_view.rs
crates/db_views/src/post_view.rs
crates/db_views/src/structs.rs
crates/db_views_actor/src/comment_reply_view.rs
crates/db_views_actor/src/community_view.rs
crates/db_views_actor/src/person_mention_view.rs
crates/db_views_actor/src/person_view.rs
crates/db_views_actor/src/structs.rs
migrations/2023-07-26-000217_create_controversial_indexes/down.sql [new file with mode: 0644]
migrations/2023-07-26-000217_create_controversial_indexes/up.sql [new file with mode: 0644]