From 43cd9b04ed3caf63c834d4dc611934f7334edf51 Mon Sep 17 00:00:00 2001 From: rob Date: Fri, 8 Jul 2022 18:14:12 -0400 Subject: [PATCH] integrating change from Sites --- app/services/comment.js | 17 +++++++++++++++++ app/views/layouts/main-sidebar.pug | 1 + app/views/layouts/main.pug | 2 +- package.json | 2 +- yarn.lock | 8 ++++---- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/app/services/comment.js b/app/services/comment.js index 96124fb..bf2f12c 100644 --- a/app/services/comment.js +++ b/app/services/comment.js @@ -253,6 +253,23 @@ class CommentService extends SiteService { } return fullComment.contentHistory || [ ]; } + + /** + * Deletes all comments filed against a given resource. + * @param {Resource} resource The resource for which all comments are to be + * deleted (physically removed from database). + */ + async deleteForResource (resource) { + const { contentReport: contentReportService } = this.dtp.services; + this.log.info('deleting all comments for resource', { resourceId: resource._id }); + await Comment + .find({ resource: resource._id }) + .cursor() + .eachAsync(async (comment) => { + await contentReportService.removeForResource(comment); + await Comment.deleteOne({ _id: comment._id }); + }, 4); + } } module.exports = { diff --git a/app/views/layouts/main-sidebar.pug b/app/views/layouts/main-sidebar.pug index 02cec44..1c647cb 100644 --- a/app/views/layouts/main-sidebar.pug +++ b/app/views/layouts/main-sidebar.pug @@ -1,5 +1,6 @@ extends main block content-container + block content-header section.uk-section.uk-section-default .uk-container div(uk-grid)#dtp-content-grid diff --git a/app/views/layouts/main.pug b/app/views/layouts/main.pug index 8629316..89e5206 100644 --- a/app/views/layouts/main.pug +++ b/app/views/layouts/main.pug @@ -52,7 +52,7 @@ html(lang='en') } } - body.dtp(class= 'dtp-dark', data-dtp-env= process.env.NODE_ENV, data-dtp-domain= site.domainKey, data-current-view= currentView) + body.dtp(class= user ? user.theme : 'dtp-light', data-dtp-env= process.env.NODE_ENV, data-dtp-domain= site.domainKey, data-current-view= currentView) include ../components/site-link diff --git a/package.json b/package.json index ed5fb6b..7391d61 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "striptags": "^3.2.0", "svg-captcha": "^1.4.0", "systeminformation": "^5.11.6", - "tinymce": "^6.0.0", + "tinymce": "^6.1.0", "uikit": "^3.11.1", "uniqid": "^5.4.0", "url-validation": "^2.1.0", diff --git a/yarn.lock b/yarn.lock index e0c58c2..78c15a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8188,10 +8188,10 @@ tiny-inflate@^1.0.2: resolved "https://registry.yarnpkg.com/tiny-inflate/-/tiny-inflate-1.0.3.tgz#122715494913a1805166aaf7c93467933eea26c4" integrity sha512-pkY1fj1cKHb2seWDy0B16HeWyczlJA9/WW3u3c4z/NiWDsO3DOU5D7nhTLE9CF0yXv/QZFY7sEJmj24dK+Rrqw== -tinymce@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/tinymce/-/tinymce-6.0.0.tgz#44945e4c12ea90d08aedf357304c24269a164e54" - integrity sha512-y4b5OhxScZiFovTgEFzI+2zEDSMfbJSQ4hfcYPg9HXvudxvDIHjc3fF73m0Sys5h8YtpWPG1fT9iJsjSnwuo2A== +tinymce@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/tinymce/-/tinymce-6.1.0.tgz#a5e13307646f2e6e1fd2923dcb664647afe3a93c" + integrity sha512-IdSdMlmuyhpEpUuabhBUaRC2NzZZxP2/CO/F+/54kTaAifB1Et5mKEty03pJYZxl6GBdFgclKRA2UU5JKJtJbA== to-absolute-glob@^2.0.0: version "2.0.2"