aboutsummaryrefslogtreecommitdiffstats
path: root/adenosine-pds
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2022-12-19 23:58:42 -0800
committerbryan newbold <bnewbold@robocracy.org>2022-12-20 00:29:58 -0800
commit8d020c0088dce778c25c43c2572a6c197869a208 (patch)
treebeafc3e4b5ed61371b8f19e9fdf42757fd43f167 /adenosine-pds
parent83569230701b17a0c24c1c9bdd197629649d92bc (diff)
downloadadenosine-8d020c0088dce778c25c43c2572a6c197869a208.tar.gz
adenosine-8d020c0088dce778c25c43c2572a6c197869a208.zip
pds: upvoteCount, not likesCount
Only fixing the display and types (including schema), not actually implementing vote counting in repo or database.
Diffstat (limited to 'adenosine-pds')
-rw-r--r--adenosine-pds/src/bsky.rs18
-rw-r--r--adenosine-pds/src/models.rs6
-rw-r--r--adenosine-pds/templates/macro.html2
3 files changed, 16 insertions, 10 deletions
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<FeedItem> {
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<Value>,
pub replyCount: u64,
pub repostCount: u64,
- pub likeCount: u64,
+ pub upvoteCount: u64,
+ pub downvoteCount: u64,
pub indexedAt: String,
pub myState: Option<Value>,
}
@@ -219,8 +220,9 @@ pub struct ThreadItem {
pub parent: Option<Box<ThreadItem>>,
pub replyCount: u64,
pub replies: Option<Vec<ThreadItem>>,
- pub likeCount: u64,
pub repostCount: u64,
+ pub upvoteCount: u64,
+ pub downvoteCount: u64,
pub indexedAt: String,
pub myState: Option<Value>,
}
diff --git a/adenosine-pds/templates/macro.html b/adenosine-pds/templates/macro.html
index 1a8f5c5..7c61230 100644
--- a/adenosine-pds/templates/macro.html
+++ b/adenosine-pds/templates/macro.html
@@ -28,7 +28,7 @@
{{ item.record["text"].as_str().unwrap() }}
<br>
<span class="counts">
- [<a href="#">{{ item.likeCount }} like</a> / <a href="#">{{ item.repostCount }} repost</a> / <a href="#">{{ item.replyCount }} reply</a>]
+ [<a href="#">{{ item.upvoteCount }} upvote</a> / <a href="#">{{ item.repostCount }} repost</a> / <a href="#">{{ item.replyCount }} reply</a>]
<a href="{{ item.uri|aturi_to_path }}" class="pink">[inspect]</a>
</span>