From 8d020c0088dce778c25c43c2572a6c197869a208 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 19 Dec 2022 23:58:42 -0800 Subject: pds: upvoteCount, not likesCount Only fixing the display and types (including schema), not actually implementing vote counting in repo or database. --- adenosine-pds/src/bsky.rs | 18 +++++++++++------- adenosine-pds/src/models.rs | 6 ++++-- 2 files changed, 15 insertions(+), 9 deletions(-) (limited to 'adenosine-pds/src') diff --git a/adenosine-pds/src/bsky.rs b/adenosine-pds/src/bsky.rs index 7be72f0..c976be2 100644 --- a/adenosine-pds/src/bsky.rs +++ b/adenosine-pds/src/bsky.rs @@ -211,7 +211,8 @@ fn feed_row_to_item(srv: &mut AtpService, row: FeedRow) -> Result { embed: None, replyCount: reply_count, repostCount: repost_count, - likeCount: like_count, + upvoteCount: like_count, + downvoteCount: 0, indexedAt: row.indexed_at, myState: None, }; @@ -330,7 +331,8 @@ pub fn bsky_get_thread( replyCount: item.replyCount, // only going to depth of one here replies: None, - likeCount: item.likeCount, + upvoteCount: item.upvoteCount, + downvoteCount: 0, repostCount: item.repostCount, indexedAt: item.indexedAt, myState: None, @@ -346,7 +348,8 @@ pub fn bsky_get_thread( parent, replyCount: post_item.replyCount, replies: Some(children), - likeCount: post_item.likeCount, + upvoteCount: post_item.upvoteCount, + downvoteCount: 0, repostCount: post_item.repostCount, indexedAt: post_item.indexedAt, myState: None, @@ -604,17 +607,18 @@ fn test_bsky_feeds() { assert_eq!(alice_feed.feed[2].embed, None); assert_eq!(alice_feed.feed[2].replyCount, 0); assert_eq!(alice_feed.feed[2].repostCount, 0); - assert_eq!(alice_feed.feed[2].likeCount, 1); + assert_eq!(alice_feed.feed[2].upvoteCount, 1); + assert_eq!(alice_feed.feed[2].downvoteCount, 0); assert_eq!(alice_feed.feed[1].author.did, alice_did.to_string()); assert_eq!(alice_feed.feed[1].replyCount, 0); assert_eq!(alice_feed.feed[1].repostCount, 1); - assert_eq!(alice_feed.feed[1].likeCount, 0); + assert_eq!(alice_feed.feed[1].upvoteCount, 0); assert_eq!(alice_feed.feed[0].author.did, alice_did.to_string()); assert_eq!(alice_feed.feed[0].replyCount, 1); assert_eq!(alice_feed.feed[0].repostCount, 0); - assert_eq!(alice_feed.feed[0].likeCount, 0); + assert_eq!(alice_feed.feed[0].upvoteCount, 0); // test bob timeline: should include alice posts let bob_timeline = bsky_get_timeline(&mut srv, &bob_did).unwrap(); @@ -760,7 +764,7 @@ fn test_bsky_thread() { assert_eq!(post.embed, None); assert_eq!(post.replyCount, 1); assert_eq!(post.repostCount, 0); - assert_eq!(post.likeCount, 0); + assert_eq!(post.upvoteCount, 0); assert_eq!(post.replies.as_ref().unwrap().len(), 1); let post_replies = post.replies.unwrap(); diff --git a/adenosine-pds/src/models.rs b/adenosine-pds/src/models.rs index 5bf4329..573ff2f 100644 --- a/adenosine-pds/src/models.rs +++ b/adenosine-pds/src/models.rs @@ -178,7 +178,8 @@ pub struct FeedItem { pub embed: Option, pub replyCount: u64, pub repostCount: u64, - pub likeCount: u64, + pub upvoteCount: u64, + pub downvoteCount: u64, pub indexedAt: String, pub myState: Option, } @@ -219,8 +220,9 @@ pub struct ThreadItem { pub parent: Option>, pub replyCount: u64, pub replies: Option>, - pub likeCount: u64, pub repostCount: u64, + pub upvoteCount: u64, + pub downvoteCount: u64, pub indexedAt: String, pub myState: Option, } -- cgit v1.2.3