support contest mode

This commit is contained in:
teddit 2020-12-27 18:56:27 +01:00
parent ced2d6f001
commit 357c6402cd
4 changed files with 13 additions and 1 deletions

View File

@ -28,6 +28,7 @@ module.exports = function(fetch) {
ups: post.ups,
id: post.id,
domain: post.domain,
contest_mode: post.contest_mode,
comments: null,
has_media: false,
media: null,

View File

@ -474,7 +474,7 @@ module.exports = (app, redis, fetch, RedditAPI) => {
sortby = config.post_comments_sort
}
if(!['confidence', 'top', 'new', 'controversial', 'old', 'qa'].includes(sortby)) {
if(!['confidence', 'top', 'new', 'controversial', 'old', 'qa', 'random'].includes(sortby)) {
console.error(`Got invalid sort.`, req.originalUrl)
return res.redirect('/')
}

View File

@ -70,6 +70,10 @@ body.dark #post .infobar {
background-color: #d2d2d2;
color: #2f2f2f;
}
body.dark #post .infobar.blue {
background: #c7e3f9;
border: 1px solid #4b78a4;
}
body.dark #post .infobar a {
color: #0356d4;
}
@ -660,6 +664,10 @@ input[type="submit"]:hover,
float: left;
width: calc(100% - 50px);
}
#post .infobar.blue {
background: #eff8ff;
border: 1px solid #93abc2;
}
#post header {
padding-top: 0px;
}

View File

@ -134,6 +134,9 @@ html
a(href="" + post.media.source + "") [media]
if post.selftext
div.usertext-body !{post.selftext}
if post.contest_mode
.infobar.blue
p this thread is in contest mode - contest mode randomizes comment sorting and hides scores.
if viewing_comment
.infobar
p you are viewing a single comment's thread.