mirror of
https://github.com/wassname/talk.git
synced 2026-06-30 22:38:31 +08:00
Merge branch 'master' into dep-upgrade
This commit is contained in:
@@ -37,6 +37,10 @@ const updateInfoBoxContent = (updateSettings) => (event) => {
|
||||
updateSettings({infoBoxContent});
|
||||
};
|
||||
|
||||
const updateAutoClose = (updateSettings, autoCloseStream) => () => {
|
||||
updateSettings({autoCloseStream});
|
||||
};
|
||||
|
||||
const updateClosedMessage = (updateSettings) => (event) => {
|
||||
const closedMessage = event.target.value;
|
||||
updateSettings({closedMessage});
|
||||
@@ -131,6 +135,11 @@ const StreamSettings = ({updateSettings, settingsError, settings, errors}) => {
|
||||
</div>
|
||||
</Card>
|
||||
<Card className={`${styles.configSetting} ${styles.configSettingInfoBox}`}>
|
||||
<div className={styles.action}>
|
||||
<Checkbox
|
||||
onChange={updateAutoClose(updateSettings, !settings.autoCloseStream)}
|
||||
checked={settings.autoCloseStream} />
|
||||
</div>
|
||||
<div className={styles.content}>
|
||||
{lang.t('configure.close-after')}
|
||||
<br />
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import React, { PropTypes } from 'react';
|
||||
import React, {PropTypes} from 'react';
|
||||
import CommentCount from './CommentCount';
|
||||
import styles from './styles.css';
|
||||
import { SelectField, Option } from 'react-mdl-selectfield';
|
||||
import {SelectField, Option} from 'react-mdl-selectfield';
|
||||
import I18n from 'coral-framework/modules/i18n/i18n';
|
||||
import translations from 'coral-admin/src/translations.json';
|
||||
import { Link } from 'react-router';
|
||||
import {Link} from 'react-router';
|
||||
|
||||
const lang = new I18n(translations);
|
||||
|
||||
const ModerationMenu = (
|
||||
{ asset, premodCount, rejectedCount, flaggedCount, selectSort, sort }
|
||||
{asset, premodCount, rejectedCount, flaggedCount, selectSort, sort}
|
||||
) => {
|
||||
const premodPath = asset
|
||||
? `/admin/moderate/premod/${asset.id}`
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { PropTypes } from 'react';
|
||||
import { Icon } from '../coral-ui';
|
||||
import React, {PropTypes} from 'react';
|
||||
import {Icon} from '../coral-ui';
|
||||
import styles from './Comment.css';
|
||||
import PubDate from '../coral-plugin-pubdate/PubDate';
|
||||
import Content from '../coral-plugin-commentcontent/CommentContent';
|
||||
|
||||
@@ -47,6 +47,10 @@ const SettingSchema = new Schema({
|
||||
organizationName: {
|
||||
type: String
|
||||
},
|
||||
autoCloseStream: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
closedTimeout: {
|
||||
type: Number,
|
||||
|
||||
|
||||
+12
-2
@@ -57,11 +57,21 @@ module.exports = class AssetsService {
|
||||
static findOrCreateByUrl(url) {
|
||||
|
||||
// Check the URL to confirm that is in the domain whitelist
|
||||
return domainlist.urlCheck(url).then((whitelisted) => {
|
||||
return Promise.all([
|
||||
domainlist.urlCheck(url),
|
||||
SettingsService.retrieve()
|
||||
]).then(([whitelisted, settings]) => {
|
||||
|
||||
const update = {$setOnInsert: {url}};
|
||||
|
||||
if (settings.autoCloseStream) {
|
||||
update.$setOnInsert.closedAt = new Date(Date.now() + settings.closedTimeout * 1000);
|
||||
}
|
||||
|
||||
if (!whitelisted) {
|
||||
return Promise.reject(errors.ErrInvalidAssetURL);
|
||||
} else {
|
||||
return AssetModel.findOneAndUpdate({url}, {url}, {
|
||||
return AssetModel.findOneAndUpdate({url}, update, {
|
||||
|
||||
// Ensure that if it's new, we return the new object created.
|
||||
new: true,
|
||||
|
||||
Reference in New Issue
Block a user