Skip to content

Commit ddd247b

Browse files
committed
feat: Show self posts
1 parent 61fe70b commit ddd247b

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/db/models.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ pub struct PostWrapper {
5353
pub post: Post,
5454
pub elapsed: String,
5555
pub depth: usize,
56+
pub is_me: bool,
5657
}
5758

5859
impl Post {

src/db/postgres.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ impl super::DB for PostgresDB {
123123
format!("{} days", mins / 60 / 24)
124124
};
125125
psts.push(PostWrapper {
126+
is_me: post.user_id == user_id,
126127
post,
127128
elapsed,
128129
depth: 0,

src/templates/template.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,13 @@
4545
{% if is_comment or can_comment %}
4646
<div style="margin: 1em {{post.depth+1}}em;">
4747
{% endif %}
48+
{% if post.is_me %}
49+
<span style="color: red; font-size: 1.1em; vertical-align: top;">*</span>
50+
{% else %}
4851
<a id="post-{{post.post.id}}" href="javascript:upvote({{post.post.id}})"
4952
style="vertical-align: top; {% if post.post.upvoted %}visibility: hidden; {% endif %}"><img
5053
src="assets/triangle.svg" style="height: 0.7em;"></a>
54+
{% endif %}
5155
<div style="display: inline-block; text-wrap: wrap;">
5256
{% if not is_comment %}
5357
<a style="color: black; text-decoration: none;"

0 commit comments

Comments
 (0)