Skip to content

Commit

Permalink
display domain name next to post title if post has a link filled in
Browse files Browse the repository at this point in the history
  • Loading branch information
ferg1e committed Jul 27, 2021
1 parent f32be7b commit c88bb90
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
9 changes: 9 additions & 0 deletions db/index.js
Expand Up @@ -246,6 +246,7 @@ exports.getPosts = (userId, timeZone, page, isDiscoverMode, filterUserId) => {
u.public_id as user_public_id,
p.link,
p.num_comments,
dn.domain_name,
u.user_id = $2 or u.user_id = $3 or
exists(select
1
Expand Down Expand Up @@ -275,6 +276,8 @@ exports.getPosts = (userId, timeZone, page, isDiscoverMode, filterUserId) => {
tpost p
join
tuser u on u.user_id = p.user_id
left join
tdomainname dn on dn.domain_name_id = p.domain_name_id
where
not is_removed and
($6 or u.user_id = $7 or u.user_id = $8 or
Expand Down Expand Up @@ -312,6 +315,7 @@ exports.getTagPosts = (userId, timeZone, page, tag, isDiscoverMode, filterUserId
u.public_id as user_public_id,
p.link,
p.num_comments,
dn.domain_name,
u.user_id = $2 or u.user_id = $3 or
exists(select
1
Expand Down Expand Up @@ -341,6 +345,8 @@ exports.getTagPosts = (userId, timeZone, page, tag, isDiscoverMode, filterUserId
tpost p
join
tuser u on u.user_id = p.user_id
left join
tdomainname dn on dn.domain_name_id = p.domain_name_id
where
not is_removed and
exists(
Expand Down Expand Up @@ -415,6 +421,7 @@ exports.getPostWithPublic2 = (publicId, timeZone, userId, filterUserId) => {
p.public_id,
p.link,
p.num_comments,
dn.domain_name,
u.user_id = $2 or u.user_id = $3 or
exists(select
1
Expand Down Expand Up @@ -444,6 +451,8 @@ exports.getPostWithPublic2 = (publicId, timeZone, userId, filterUserId) => {
tpost p
join
tuser u on u.user_id = p.user_id
left join
tdomainname dn on dn.domain_name_id = p.domain_name_id
where
p.public_id = $6 and
not p.is_removed`,
Expand Down
6 changes: 6 additions & 0 deletions public/cillmit99b/style.css
Expand Up @@ -270,3 +270,9 @@ pre {
font-weight: normal;
color: #0000d2;
}

.domname1 {
color: #74ad6d;
font-size: 14px;
font-size: .875rem;
}
2 changes: 2 additions & 0 deletions views/posts2.pug
Expand Up @@ -41,6 +41,8 @@ block content
a(class="ptitle" href=`/p/${post.public_id}`) #{post.title}
else
a(class="ptitle" href=post.link)= post.title
|
span.domname1 (#{post.domain_name})

div
span(class="puser") by #{post.username}
Expand Down
2 changes: 2 additions & 0 deletions views/single-post.pug
Expand Up @@ -21,6 +21,8 @@ block content
else
h3
a(href=post.link)=post.title
|
span.domname1 (#{post.domain_name})

div
span(class="puser") by #{post.username}
Expand Down

0 comments on commit c88bb90

Please sign in to comment.