mirror of
https://github.com/wassname/talk.git
synced 2026-07-13 17:45:56 +08:00
Liniting
This commit is contained in:
@@ -3,7 +3,6 @@ import {I18n} from '../coral-framework';
|
||||
import translations from './translations.json';
|
||||
import {Button} from 'coral-ui';
|
||||
import {Slot} from 'coral-framework';
|
||||
import styles from './styles.css';
|
||||
import merge from 'lodash/merge';
|
||||
|
||||
const name = 'coral-plugin-commentbox';
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
import React from 'react';
|
||||
import styles from './styles.css';
|
||||
import {addCommentTag} from 'coral-framework/graphql/mutations';
|
||||
import {compose} from 'react-apollo';
|
||||
|
||||
class OffTopicCheckbox extends React.Component {
|
||||
|
||||
handleChange = (e) => {
|
||||
|
||||
if (e.target.checked) {
|
||||
this.props.addCommentHooks({
|
||||
postSubmit: {
|
||||
addTag: (data) => {
|
||||
console.log('This is a hook after posting')
|
||||
const {comment} = data.createComment;
|
||||
this.props.addCommentTag({
|
||||
id: comment.id,
|
||||
tag: 'OFF_TOPIC',
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -23,9 +28,6 @@ class OffTopicCheckbox extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<div className={styles.offTopic}>
|
||||
<label>
|
||||
@@ -37,4 +39,4 @@ class OffTopicCheckbox extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default OffTopicCheckbox;
|
||||
export default compose(addCommentTag)(OffTopicCheckbox);
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
import React from 'react';
|
||||
import styles from './styles.css';
|
||||
|
||||
const isOffTopic = (tags) => {
|
||||
return !!tags.filter(tag => tag.name === 'OFF_TOPIC').length
|
||||
}
|
||||
|
||||
export default (props) => (
|
||||
<span className={styles.tag}>
|
||||
Off-topic
|
||||
<span>
|
||||
{
|
||||
isOffTopic(props.comment.tags) ? (
|
||||
<span className={styles.tag}>
|
||||
Off-topic
|
||||
</span>
|
||||
) : null
|
||||
}
|
||||
</span>
|
||||
);
|
||||
|
||||
@@ -3,10 +3,10 @@ const CommentModel = require('../models/comment');
|
||||
const ActionModel = require('../models/action');
|
||||
const ActionsService = require('./actions');
|
||||
|
||||
const ALLOWED_TAGS = [
|
||||
{name: 'STAFF'},
|
||||
{name: 'BEST'},
|
||||
];
|
||||
// const ALLOWED_TAGS = [
|
||||
// {name: 'STAFF'},
|
||||
// {name: 'BEST'},
|
||||
// ];
|
||||
|
||||
const STATUSES = [
|
||||
'ACCEPTED',
|
||||
@@ -53,9 +53,10 @@ module.exports = class CommentsService {
|
||||
*/
|
||||
static addTag(id, name, assigned_by) {
|
||||
|
||||
if (ALLOWED_TAGS.find((t) => t.name === name) == null) {
|
||||
return Promise.reject(new Error('tag not allowed'));
|
||||
}
|
||||
// Disabling allowed tags until we are able to extend them
|
||||
// if (ALLOWED_TAGS.find((t) => t.name === name) == null) {
|
||||
// return Promise.reject(new Error('tag not allowed'));
|
||||
// }
|
||||
|
||||
const filter = {
|
||||
id,
|
||||
|
||||
Reference in New Issue
Block a user