Less deprecation messages

This commit is contained in:
Chi Vinh Le
2018-03-21 16:48:28 +01:00
parent 1256007eba
commit a4987f2947
+13 -27
View File
@@ -1,7 +1,6 @@
import * as actions from '../constants/stream';
import { buildUrl } from 'coral-framework/utils/url';
import queryString from 'query-string';
import once from 'lodash/once';
export const setActiveReplyBox = id => ({
type: actions.SET_ACTIVE_REPLY_BOX,
@@ -73,31 +72,18 @@ export const setActiveTab = tab => dispatch => {
};
// @Deprecated
const showOldTagsWarningOnce = once(() => {
if (process.env.NODE_ENV !== 'production') {
console.warn(
'`addCommentBoxTag`, `removeCommentBoxTag`, `clearCommentBoxTags` are deprecated. Please switch to `onInputChange`, `input.tags` instead'
);
}
export const addCommentBoxTag = tag => ({
type: actions.ADD_COMMENT_BOX_TAG,
tag,
});
export const addCommentBoxTag = tag => {
showOldTagsWarningOnce();
return {
type: actions.ADD_COMMENT_BOX_TAG,
tag,
};
};
export const removeCommentBoxTag = idx => {
showOldTagsWarningOnce();
return {
type: actions.REMOVE_COMMENT_BOX_TAG,
idx,
};
};
export const clearCommentBoxTags = () => {
showOldTagsWarningOnce();
return {
type: actions.CLEAR_COMMENT_BOX_TAGS,
};
};
// @Deprecated
export const removeCommentBoxTag = idx => ({
type: actions.REMOVE_COMMENT_BOX_TAG,
idx,
});
// @Deprecated
export const clearCommentBoxTags = () => ({
type: actions.CLEAR_COMMENT_BOX_TAGS,
});