Merge branch 'develop' of git.digitaltelepresence.com:digital-telepresence/dtp-base into develop

master
rob 1 year ago
commit 571fcd4f54

@ -81,6 +81,7 @@ class AdminController extends SiteController {
async getHomeView (req, res, next) {
const {
chat: chatService,
comment: commentService,
coreNode: coreNodeService,
dashboard: dashboardService,
venue: venueService,
@ -106,6 +107,7 @@ class AdminController extends SiteController {
res.locals.admins = await userService.getAdmins();
res.locals.moderators = await userService.getModerators();
res.locals.recentComments = await commentService.getRecent(10);
res.locals.recentChat = await chatService.getRecent(10);
loganService.sendRequestEvent(module.exports, req, {

@ -251,6 +251,21 @@ class CommentService extends SiteService {
return comments;
}
/**
* Meant for use in admin tools.
*/
async getRecent (pagination) {
const comments = await Comment
.find()
.sort({ created: -1 })
.skip(pagination.skip)
.limit(pagination.cpp)
.populate(this.populateComment)
.lean();
const totalCommentCount = await Comment.estimatedDocumentCount();
return { comments, totalCommentCount };
}
async getForAuthor (author, pagination) {
const comments = await Comment
.find({ // index: 'comment_author_by_type'

@ -4,6 +4,7 @@ block content
include ../venue/components/channel-grid
include user/components/list-item
include ../chat/components/message
include ../comment/components/comment
div(uk-grid)
div(class="uk-width-1-1 uk-width-auto@m")
@ -53,6 +54,15 @@ block content
else
div There are no system-level moderators.
h3 Recent Members
if Array.isArray(recentMembers) && (recentMembers.length > 0)
ul.uk-list.uk-list-divider
each member in recentMembers
li
+renderUserListItem(member)
else
div There are no recent members.
div(class="uk-width-1-1 uk-width-1-3@l")
h3 Recent Chat
if Array.isArray(recentChat) && (recentChat.length > 0)
@ -70,14 +80,20 @@ block content
div There is no recent chat.
div(class="uk-width-1-1 uk-width-1-3@l")
h3 Recent Members
if Array.isArray(recentMembers) && (recentMembers.length > 0)
h3 Recent Comments
if Array.isArray(recentComments.comments) && (recentComments.comments.length > 0)
ul.uk-list.uk-list-divider
each member in recentMembers
each comment in recentComments.comments
li
+renderUserListItem(member)
div(uk-grid).uk-grid-small
.uk-width-expand
+renderComment(comment)
.uk-width-auto
a(href=`/admin/user/local/${comment.author._id}`, uk-tooltip={ title: 'Manage user account' }).uk-button.uk-button-default.uk-button-small.uk-border-rounded
span
i.fas.fa-wrench
else
div There are no recent members.
div There are no recent comments.
block viewjs
script(src="/chart.js/chart.min.js")

Loading…
Cancel
Save