mirror of
https://github.com/wassname/talk.git
synced 2026-08-04 13:23:35 +08:00
Not connecting comment Component to the Store
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
import React, {PropTypes} from 'react';
|
||||
import {connect} from 'react-redux';
|
||||
import cn from 'classnames';
|
||||
|
||||
import PermalinkButton from 'coral-plugin-permalinks/PermalinkButton';
|
||||
|
||||
import AuthorName from 'coral-plugin-author-name/AuthorName';
|
||||
|
||||
import TagLabel from 'coral-plugin-tag-label/TagLabel';
|
||||
import Content from 'coral-plugin-commentcontent/CommentContent';
|
||||
import PubDate from 'coral-plugin-pubdate/PubDate';
|
||||
@@ -19,8 +17,8 @@ import {
|
||||
} from 'coral-plugin-best/BestButton';
|
||||
import Slot from 'coral-framework/components/Slot';
|
||||
import LoadMore from './LoadMore';
|
||||
import IgnoredCommentTombstone from './IgnoredCommentTombstone';
|
||||
import {TopRightMenu} from './TopRightMenu';
|
||||
import IgnoredCommentTombstone from './IgnoredCommentTombstone';
|
||||
import {EditableCommentContent} from './EditableCommentContent';
|
||||
import {getActionSummary, iPerformedThisAction} from 'coral-framework/utils';
|
||||
import {getEditableUntilDate} from './util';
|
||||
@@ -38,7 +36,7 @@ const ActionButton = ({children}) => {
|
||||
);
|
||||
};
|
||||
|
||||
class Comment extends React.Component {
|
||||
export default class Comment extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
@@ -449,10 +447,6 @@ class Comment extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = ({comment}) => ({classNames: comment.classNames});
|
||||
|
||||
export default connect(mapStateToProps, null)(Comment);
|
||||
|
||||
// return whether the comment is editable
|
||||
function commentIsStillEditable (comment) {
|
||||
const editing = comment && comment.editing;
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
import React, {PropTypes} from 'react';
|
||||
import LoadMore from './LoadMore';
|
||||
import NewCount from './NewCount';
|
||||
|
||||
import Comment from '../containers/Comment';
|
||||
import SuspendedAccount from './SuspendedAccount';
|
||||
import RestrictedMessageBox
|
||||
from 'coral-framework/components/RestrictedMessageBox';
|
||||
import ViewingOptions from './ViewingOptions';
|
||||
import SuspendedAccount from './SuspendedAccount';
|
||||
import Slot from 'coral-framework/components/Slot';
|
||||
import InfoBox from 'coral-plugin-infobox/InfoBox';
|
||||
import {can} from 'coral-framework/services/perms';
|
||||
import {ModerationLink} from 'coral-plugin-moderation';
|
||||
import RestrictedMessageBox
|
||||
from 'coral-framework/components/RestrictedMessageBox';
|
||||
import t, {timeago} from 'coral-framework/services/i18n';
|
||||
import CommentBox from 'coral-plugin-commentbox/CommentBox';
|
||||
import QuestionBox from 'coral-plugin-questionbox/QuestionBox';
|
||||
import IgnoredCommentTombstone from './IgnoredCommentTombstone';
|
||||
|
||||
import t, {timeago} from 'coral-framework/services/i18n';
|
||||
|
||||
class Stream extends React.Component {
|
||||
setActiveReplyBox = (reactKey) => {
|
||||
if (!this.props.auth.user) {
|
||||
@@ -28,6 +26,7 @@ class Stream extends React.Component {
|
||||
|
||||
render() {
|
||||
const {
|
||||
classNames,
|
||||
root: {asset, asset: {comments}, comment, me},
|
||||
postComment,
|
||||
addNotification,
|
||||
@@ -36,10 +35,10 @@ class Stream extends React.Component {
|
||||
deleteAction,
|
||||
showSignInDialog,
|
||||
addCommentTag,
|
||||
removeCommentTag,
|
||||
pluginProps,
|
||||
ignoreUser,
|
||||
auth: {loggedIn, user},
|
||||
removeCommentTag,
|
||||
pluginProps,
|
||||
commentCountCache,
|
||||
editName
|
||||
} = this.props;
|
||||
@@ -159,6 +158,7 @@ class Stream extends React.Component {
|
||||
return commentIsIgnored(comment)
|
||||
? <IgnoredCommentTombstone key={comment.id} />
|
||||
: <Comment
|
||||
classNames={classNames}
|
||||
data={this.props.data}
|
||||
root={this.props.root}
|
||||
disableReply={!open}
|
||||
|
||||
@@ -323,6 +323,7 @@ const mapStateToProps = (state) => ({
|
||||
assetUrl: state.stream.assetUrl,
|
||||
activeTab: state.embed.activeTab,
|
||||
previousTab: state.embed.previousTab,
|
||||
classNames: state.comment.classNames
|
||||
});
|
||||
|
||||
const mapDispatchToProps = (dispatch) =>
|
||||
|
||||
@@ -8,6 +8,7 @@ import plugins from 'pluginsConfig';
|
||||
import {getDefinitionName, mergeDocuments} from 'coral-framework/utils';
|
||||
import {loadTranslations} from 'coral-framework/services/i18n';
|
||||
|
||||
console.log(plugins)
|
||||
export const pluginReducers = merge(
|
||||
...plugins
|
||||
.filter((o) => o.module.reducer)
|
||||
|
||||
@@ -3,7 +3,7 @@ import user from './user';
|
||||
import asset from './asset';
|
||||
import {reducer as commentBox} from '../../coral-plugin-commentbox';
|
||||
import {pluginReducers} from '../helpers/plugins';
|
||||
|
||||
console.log(pluginReducers)
|
||||
export default {
|
||||
auth,
|
||||
user,
|
||||
|
||||
@@ -18,14 +18,14 @@ class OffTopicFilter extends React.Component {
|
||||
const idx = this.props.comment.classNames.indexOf(this.cn);
|
||||
this.props.removeClassName(idx);
|
||||
}
|
||||
props.closeViewingOptions();
|
||||
this.props.closeViewingOptions();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className={styles.viewingOption}>
|
||||
<label>
|
||||
<input type="checkbox" onChange={this.handleChange}/>
|
||||
<input type="checkbox" onChange={this.handleChange} checked={true}/>
|
||||
Hide Off-Topic Comments
|
||||
</label>
|
||||
</div>
|
||||
@@ -33,7 +33,7 @@ class OffTopicFilter extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = ({comment}) => ({comment});
|
||||
const mapStateToProps = ({comment, offTopicFilter}) => ({comment, offTopicFilter});
|
||||
|
||||
const mapDispatchToProps = (dispatch) =>
|
||||
bindActionCreators({addClassName, removeClassName, closeViewingOptions}, dispatch);
|
||||
|
||||
@@ -2,9 +2,11 @@ import OffTopicCheckbox from './components/OffTopicCheckbox';
|
||||
import OffTopicTag from './components/OffTopicTag';
|
||||
import OffTopicFilter from './components/OffTopicFilter';
|
||||
import translations from './translations.json';
|
||||
import reducer from './reducer';
|
||||
|
||||
export default {
|
||||
translations,
|
||||
reducer,
|
||||
slots: {
|
||||
commentInputDetailArea: [OffTopicCheckbox],
|
||||
streamViewingOptions: [OffTopicFilter],
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
const initialState = {
|
||||
filter: true
|
||||
};
|
||||
|
||||
export default function offTopic (state = initialState, action) {
|
||||
switch (action.type) {
|
||||
default :
|
||||
return state;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user