mirror of
https://github.com/wassname/talk.git
synced 2026-08-16 11:29:31 +08:00
Conflicts: client/coral-admin/src/reducers/moderation.js client/coral-embed-stream/src/actions/stream.js client/coral-embed-stream/src/components/Stream.js client/coral-framework/components/Slot.js plugin-api/beta/client/utils/index.js test/server/routes/api/account/index.js
66 lines
1.8 KiB
JavaScript
66 lines
1.8 KiB
JavaScript
import * as actions from '../constants/stream';
|
|
import {buildUrl} from 'coral-framework/utils/url';
|
|
import queryString from 'query-string';
|
|
|
|
export const setActiveReplyBox = (id) => ({type: actions.SET_ACTIVE_REPLY_BOX, id});
|
|
|
|
export const setSort = ({sortOrder, sortBy}) => ({type: actions.SET_SORT, sortOrder, sortBy});
|
|
|
|
export const viewAllComments = () => (dispatch, _, {pym}) => {
|
|
|
|
const search = queryString.stringify({
|
|
...queryString.parse(location.search),
|
|
comment_id: undefined,
|
|
});
|
|
|
|
// remove the comment_id url param
|
|
const url = buildUrl({...location, search});
|
|
|
|
try {
|
|
|
|
// "window" here refers to the embedded iframe
|
|
window.history.replaceState({}, document.title, url);
|
|
|
|
// also change the parent url
|
|
pym.sendMessage('coral-view-all-comments');
|
|
} catch (e) { /* not sure if we're worried about old browsers */ }
|
|
|
|
dispatch({type: actions.VIEW_ALL_COMMENTS});
|
|
};
|
|
|
|
export const viewComment = (id) => (dispatch, _, {pym}) => {
|
|
|
|
const search = queryString.stringify({
|
|
...queryString.parse(location.search),
|
|
comment_id: id,
|
|
});
|
|
|
|
// remove the comment_id url param
|
|
const url = buildUrl({...location, search});
|
|
|
|
try {
|
|
|
|
// "window" here refers to the embedded iframe
|
|
window.history.replaceState({}, document.title, url);
|
|
|
|
// also change the parent url
|
|
pym.sendMessage('coral-view-comment', id);
|
|
} catch (e) { /* not sure if we're worried about old browsers */ }
|
|
|
|
dispatch({type: actions.VIEW_COMMENT, id});
|
|
};
|
|
|
|
export const addCommentClassName = (className) => ({
|
|
type: actions.ADD_COMMENT_CLASSNAME,
|
|
className
|
|
});
|
|
|
|
export const removeCommentClassName = (idx) => ({
|
|
type: actions.REMOVE_COMMENT_CLASSNAME,
|
|
idx
|
|
});
|
|
|
|
export const setActiveTab = (tab) => (dispatch) => {
|
|
dispatch({type: actions.SET_ACTIVE_TAB, tab});
|
|
};
|