cleanup and make hotposts more to my taste

merge-requests/341/head
Thomas Lynch 2 years ago
parent 81d4d7c8f0
commit cd254e7c40
  1. 19
      db/posts.js
  2. 7
      gulp/res/css/style.css
  3. 2
      lib/build/tasks.js
  4. 27
      views/pages/home.pug

@ -2,6 +2,7 @@
const Mongo = require(__dirname+'/db.js')
, { isIP } = require('net')
, { DAY } = require(__dirname+'/../lib/converter/timeutils.js')
, Boards = require(__dirname+'/boards.js')
, Stats = require(__dirname+'/stats.js')
, Permissions = require(__dirname+'/../lib/permission/permissions.js')
@ -708,6 +709,24 @@ module.exports = {
]).toArray();
},
hotThreads: async () => {
const listedBoards = await Boards.getLocalListed();
return db.find({
'board': {
'$in': listedBoards
},
'thread': null,
'date': {
//created in last 7 days
'$gte': new Date(Date.now() - (7 * DAY))
},
}).sort({
'replyposts': -1
})
.limit(5) //top 5 threads
.toArray();
},
deleteMany: (ids) => {
return db.deleteMany({
'_id': {

@ -1446,6 +1446,10 @@ row.wrap.sb .col {
flex-basis: calc(50% - 5px);
}
#hotposts td:nth-child(1) {
white-space: nowrap;
}
@media only screen and (max-height: 400px) {
.modal {
top: 5px;
@ -1484,6 +1488,9 @@ row.wrap.sb .col {
margin-left: 3px;
width: 1em;
}
#hotposts td:nth-child(3) {
display: none;
}
#settings::after {
content: "\2699"!important;
}

@ -251,7 +251,7 @@ module.exports = {
Boards.boardSort(0, 20), //top 20 boards sorted by users, pph, total posts
Files.activeContent(), //size and number of files
News.find(maxRecentNews), //some recent newsposts
Posts.db.find({'board': {$in: listedBoards}, 'thread': null, 'date': {$gte: (new Date(Date.now() - (7 * 24 * 60 * 60 * 1000)))}}).sort({'replyposts':-1}).limit(5).toArray(), //top 5 threads last 7 days
Posts.hotThreads(), //top 5 threads last 7 days
]);
const [ localStats, webringStats ] = totalStats;
const { html } = await render('index.html', 'home.pug', {

@ -30,20 +30,27 @@ block content
time.right.reltime(datetime=newsDate.toISOString()) #{newsDate.toLocaleString(undefined, {hourCycle:'h23'})}
if hotThreads && hotThreads.length > 0
.table-container.flex-center.mv-5
table.posttable
table#hotposts
tr(colspan=3)
each post in hotThreads
each post, i in hotThreads
tr
td 🔥#{post.replyposts + post.replyfiles}
td.text-center
span.help(title='Hot Thread') 🔥
| #{post.replyposts + post.replyfiles}
td
if post.nomarkup != null
a.quote(href=`/${post.board}/thread/${post.postId}.html#${post.postId}`) #{`${post.subject.substring(0,30)}${post.subject && post.subject.length > 30 ? '...' : ''} ${post.nomarkup && post.nomarkup.substring(0,50)}${post.nomarkup && post.nomarkup.length > 50 ? '...' : ''}`}
if post.nomarkup === null
a.quote(href=`/${post.board}/thread/${post.postId}.html#${post.postId}`) (No comment.)
- const threadLink = `/${post.board}/thread/${post.postId}.html#${post.postId}`;
a.quote(href=threadLink)
if post.subject
| #{post.subject.substring(0,30)}#{post.subject.length > 30 ? '...' : ''}
if post.nomarkup
| -
if post.nomarkup
| #{post.nomarkup.substring(0,40)}#{post.nomarkup.length > 40 ? '...' : ''}
if !post.nomarkup && !post.subject
| >>>/#{post.board}/#{post.postId}
td
- const newsDate = new Date(post.bumped);
time.right.reltime(datetime=newsDate.toISOString()) #{newsDate.toLocaleString(undefined, {hourCycle:'h23'})}
- const bumpDate = new Date(post.bumped);
time.right.reltime(datetime=bumpDate.toISOString()) #{bumpDate.toLocaleString(undefined, {hourCycle:'h23'})}
if boards && boards.length > 0
+boardtable(true, false)
each board in boards

Loading…
Cancel
Save