Support changing list replies policy from web UI

Modifest the arguments sent to the updateList function to properly set the new replies policy value, as well allowing for an undefined value for the exclusive setting which will result in no new value being sent to the API for that attribute--that is, it will be left unchanged unless otherwise specified.

Fixes #1191
This commit is contained in:
John Holdun 2022-11-09 18:04:45 -08:00
parent 69ff67746b
commit 4f7fa085cb
2 changed files with 2 additions and 2 deletions

View File

@ -160,7 +160,7 @@ export const createListFail = error => ({
export const updateList = (id, title, shouldReset, isExclusive, replies_policy) => (dispatch, getState) => {
dispatch(updateListRequest(id));
api(getState).put(`/api/v1/lists/${id}`, { title, replies_policy, is_exclusive: !!isExclusive }).then(({ data }) => {
api(getState).put(`/api/v1/lists/${id}`, { title, replies_policy, is_exclusive: typeof isExclusive === 'undefined' ? undefined : !!isExclusive }).then(({ data }) => {
dispatch(updateListSuccess(data));
if (shouldReset) {

View File

@ -137,7 +137,7 @@ class ListTimeline extends React.PureComponent {
handleRepliesPolicyChange = ({ target }) => {
const { dispatch } = this.props;
const { id } = this.props.params;
dispatch(updateList(id, undefined, false, target.value));
dispatch(updateList(id, undefined, false, undefined, target.value));
}
render () {