e9a2f44899
## General - `setting.List`: returns full creator settings. Requires signature (i.e. you own the channel) - `setting.Get`: returns a public subset of the creator settings. No signature required, and it is mainly used by the GUI to determine the constraints of a channel (e.g. comments enabled? min tip requirements? etc.). Does not include private settings like "blocked words list". `doFetchCreatorSettings` will handle both of these. Clients that uses the stashed results (`settingsByChannelId`) just needs to be aware the result might not contain everything, depending on whether you own the channel or not. ## Misc Related Changes - Finally fix the reducer for COMMENT_FETCH_SETTINGS_COMPLETED to not purge the data on each call. - Change `doFetchCreatorSettings` to operate on a single channel instead of multiple. We ended up not using the multple mode anyway, so it was wasteful code trying to batch the promises. - `commentsDisabledChannelIds` is no longer needed. Previously, this was created just to differentiate between Creator (full) and Channel (subset) settings. It's cleaner to just use one object, so eliminated this. - Remove unused 'commentingEnabled'. ## Aside - There are now 2 ways to know if a channel has disabled comments: (1) from `comment.list` and `setting.Get|List`. Both of them updates `settingsByChannelId`, so it'll still be a single place for the GUI to check against.
42 lines
1.9 KiB
JavaScript
42 lines
1.9 KiB
JavaScript
import { connect } from 'react-redux';
|
|
import SettingsCreatorPage from './view';
|
|
import {
|
|
doCommentBlockWords,
|
|
doCommentUnblockWords,
|
|
doCommentModAddDelegate,
|
|
doCommentModRemoveDelegate,
|
|
doCommentModListDelegates,
|
|
doFetchCreatorSettings,
|
|
doUpdateCreatorSettings,
|
|
} from 'redux/actions/comments';
|
|
import { selectActiveChannelClaim } from 'redux/selectors/app';
|
|
import {
|
|
selectSettingsByChannelId,
|
|
selectFetchingCreatorSettings,
|
|
selectFetchingBlockedWords,
|
|
selectModerationDelegatesById,
|
|
} from 'redux/selectors/comments';
|
|
import { doToast } from 'redux/actions/notifications';
|
|
|
|
const select = (state) => ({
|
|
activeChannelClaim: selectActiveChannelClaim(state),
|
|
settingsByChannelId: selectSettingsByChannelId(state),
|
|
fetchingCreatorSettings: selectFetchingCreatorSettings(state),
|
|
fetchingBlockedWords: selectFetchingBlockedWords(state),
|
|
moderationDelegatesById: selectModerationDelegatesById(state),
|
|
});
|
|
|
|
const perform = (dispatch) => ({
|
|
commentBlockWords: (channelClaim, words) => dispatch(doCommentBlockWords(channelClaim, words)),
|
|
commentUnblockWords: (channelClaim, words) => dispatch(doCommentUnblockWords(channelClaim, words)),
|
|
fetchCreatorSettings: (channelClaimId) => dispatch(doFetchCreatorSettings(channelClaimId)),
|
|
updateCreatorSettings: (channelClaim, settings) => dispatch(doUpdateCreatorSettings(channelClaim, settings)),
|
|
commentModAddDelegate: (modChanId, modChanName, creatorChannelClaim) =>
|
|
dispatch(doCommentModAddDelegate(modChanId, modChanName, creatorChannelClaim)),
|
|
commentModRemoveDelegate: (modChanId, modChanName, creatorChannelClaim) =>
|
|
dispatch(doCommentModRemoveDelegate(modChanId, modChanName, creatorChannelClaim)),
|
|
commentModListDelegates: (creatorChannelClaim) => dispatch(doCommentModListDelegates(creatorChannelClaim)),
|
|
doToast: (options) => dispatch(doToast(options)),
|
|
});
|
|
|
|
export default connect(select, perform)(SettingsCreatorPage);
|