Ladislawgrowlo

joined 8 months ago
 

It would be interesting to sort posts in different ways then the current Active, Hot, New, ... Criteria. I searched the backend-codebase and found this enum:

crates/db_shema_file/src/enums.rs

...
/// The post sort types. See here for descriptions: https://join-lemmy.org/docs/en/users/03-votes-and-ranking.html
pub enum PostSortType {
  #[default]
  Active,
  Hot,
  New,
  Old,
  Top,
  MostComments,
  NewComments,
  Controversial,
  Scaled,
}

and the database uses this for example in crates/db_views/post/src/impls.rs

NewComments => pq.then_order_by(key::newest_comment_time_at),

I have multiple questions regarding this:

  • lets say I add another variant to this enum, and add some functionality to it in the backend, would the frontend dropdown-menu in the UI update and show it? (guess this is not the case, since frontend and backend live in different folders.
  • here is a sample sorting url for the Scaled sort type "https://lemmy.world/?dataType=Post&listingType=All&sort=Scaled". This will trigger the backend to query the database and receive a sorted list of items to display as hypertext to my understanding.
  • since Diesel implements the Database Query I would not need to write any postgresql?
  • would other instances support my new sorting method or only my own modified codebase instance? I guess its the latter.

A first simple idea: Add a "random" sort type, that sorts post in random order. Some uuid or hashed timestamp of a post could work for this.

 

cross-posted from: https://lemy.lol/post/45037893

I remember finding out about lemy a while back but i never really came, but now i understand the importance of this place. there are these mindflayers, these tentacle gorgon beings that want to put their version of the story into everything. they are afraid of upvotes that decide themselves. remember aaron? he was the original luigi.

dear lemians, we need to advertise this website, based on our free love of free information towards sabachtan gnosis. this isn't just another website, this is the religion of freedom.

let's make it happen, from a cyberpunk past to a solarpunk future.

ps holy smack this website has "avesta" as a language. that is pure dopeness.