mirror of
https://github.com/wassname/talk.git
synced 2026-09-09 11:38:08 +08:00
Merge branch 'master' into asset-settings
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
const express = require('express');
|
||||
const Setting = require('../../../models/setting');
|
||||
const _ = require('lodash');
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
@@ -8,8 +7,7 @@ router.get('/', (req, res, next) => {
|
||||
Setting
|
||||
.getSettings()
|
||||
.then(settings => {
|
||||
const whitelist = ['moderation'];
|
||||
res.json(_.pick(settings, whitelist));
|
||||
res.json(settings);
|
||||
})
|
||||
.catch(next);
|
||||
});
|
||||
|
||||
@@ -14,7 +14,6 @@ router.get('/', (req, res, next) => {
|
||||
|
||||
// Get the asset_id for this url (or create it if it doesn't exist)
|
||||
Promise.all([
|
||||
|
||||
// Find or create the asset by url.
|
||||
Asset.findOrCreateByUrl(decodeURIComponent(req.query.asset_url))
|
||||
|
||||
@@ -38,14 +37,12 @@ router.get('/', (req, res, next) => {
|
||||
settings = Object.assign(settings, asset.settings);
|
||||
}
|
||||
|
||||
// Fetch the appropriate comments stream.
|
||||
// Fetch the appropriate comments stream.
|
||||
let comments;
|
||||
|
||||
if (settings.moderation === 'post') {
|
||||
comments = Comment.findAcceptedByAssetId(asset.id);
|
||||
} else {
|
||||
|
||||
// Defaults to 'pre' moderation.
|
||||
comments = Comment.findAcceptedAndNewByAssetId(asset.id);
|
||||
}
|
||||
|
||||
@@ -93,7 +90,7 @@ router.get('/', (req, res, next) => {
|
||||
// It's comments...
|
||||
comments,
|
||||
|
||||
// All the users/authors of those comments...
|
||||
// The users who wrote those comments
|
||||
users,
|
||||
|
||||
// And all actions about the asset, comments, and users.
|
||||
@@ -104,7 +101,6 @@ router.get('/', (req, res, next) => {
|
||||
]);
|
||||
})
|
||||
.then(([asset, comments, users, actions, settings]) => {
|
||||
|
||||
// Send back the payload containing all this data.
|
||||
res.json({
|
||||
assets: [asset],
|
||||
|
||||
Reference in New Issue
Block a user