diff --git a/ui/component/commentCreate/index.js b/ui/component/commentCreate/index.js index 951a80bb2..0536f0172 100644 --- a/ui/component/commentCreate/index.js +++ b/ui/component/commentCreate/index.js @@ -15,6 +15,7 @@ import { selectActiveChannelClaim } from 'redux/selectors/app'; import { selectSettingsByChannelId } from 'redux/selectors/comments'; import { makeSelectClientSetting } from 'redux/selectors/settings'; import * as SETTINGS from 'constants/settings'; +import { doSetClientSetting } from 'redux/actions/settings'; const select = (state, props) => { const claim = selectClaimForUri(state, props.uri); @@ -27,6 +28,7 @@ const select = (state, props) => { settingsByChannelId: selectSettingsByChannelId(state), supportDisabled: makeSelectTagInClaimOrChannelForUri(props.uri, DISABLE_SUPPORT_TAG)(state), customCommentServers: makeSelectClientSetting(SETTINGS.CUSTOM_COMMENTS_SERVERS)(state), + commentServer: makeSelectClientSetting(SETTINGS.CUSTOM_COMMENTS_SERVER_URL)(state), }; }; @@ -37,6 +39,7 @@ const perform = (dispatch, ownProps) => ({ doToast: (options) => dispatch(doToast(options)), fetchComment: (commentId) => dispatch(doCommentById(commentId, false)), sendTip: (params, callback, errorCallback) => dispatch(doSendTip(params, false, callback, errorCallback, false)), + setCommentServer: (url) => dispatch(doSetClientSetting(SETTINGS.CUSTOM_COMMENTS_SERVER_URL, url, true)), }); export default connect(select, perform)(CommentCreate); diff --git a/ui/component/commentCreate/view.jsx b/ui/component/commentCreate/view.jsx index e7e189bb6..0985a0ff8 100644 --- a/ui/component/commentCreate/view.jsx +++ b/ui/component/commentCreate/view.jsx @@ -65,6 +65,8 @@ type Props = { setQuickReply: (any) => void, toast: (string) => void, customCommentServers: Array, + setCommentServer: (string) => void, + commentServer: string, }; export function CommentCreate(props: Props) { @@ -90,6 +92,8 @@ export function CommentCreate(props: Props) { sendTip, setQuickReply, customCommentServers, + setCommentServer, + commentServer, } = props; const defaultServer = { name: COMMENT_SERVER_NAME, url: COMMENT_SERVER_API }; @@ -102,7 +106,6 @@ export function CommentCreate(props: Props) { location: { pathname }, } = useHistory(); - const [commentServer, setCommentServer] = React.useState(defaultServer.url); const [isSubmitting, setSubmitting] = React.useState(false); const [commentFailure, setCommentFailure] = React.useState(false); const [successTip, setSuccessTip] = React.useState({ txid: undefined, tipAmount: undefined });