diff --git a/app/controllers/post_statuses_controller.rb b/app/controllers/post_statuses_controller.rb index 1f245171..7a027c38 100644 --- a/app/controllers/post_statuses_controller.rb +++ b/app/controllers/post_statuses_controller.rb @@ -75,6 +75,6 @@ class PostStatusesController < ApplicationController def post_status_params params .require(:post_status) - .permit(:name, :color) + .permit(:name, :color, :show_in_roadmap) end end diff --git a/app/controllers/site_settings_controller.rb b/app/controllers/site_settings_controller.rb index a6987fcf..1b0b2240 100644 --- a/app/controllers/site_settings_controller.rb +++ b/app/controllers/site_settings_controller.rb @@ -11,4 +11,7 @@ class SiteSettingsController < ApplicationController def post_statuses end + + def roadmap + end end \ No newline at end of file diff --git a/app/javascript/actions/PostStatus/requestPostStatuses.ts b/app/javascript/actions/PostStatus/requestPostStatuses.ts index 21c2eafb..e4e368c1 100644 --- a/app/javascript/actions/PostStatus/requestPostStatuses.ts +++ b/app/javascript/actions/PostStatus/requestPostStatuses.ts @@ -1,7 +1,7 @@ import { Action } from 'redux'; import { ThunkAction } from 'redux-thunk'; -import IPostStatus from '../../interfaces/IPostStatus'; +import IPostStatusJSON from '../../interfaces/json/IPostStatus'; import { State } from '../../reducers/rootReducer'; @@ -13,7 +13,7 @@ interface PostStatusesRequestStartAction { export const POST_STATUSES_REQUEST_SUCCESS = 'POST_STATUSES_REQUEST_SUCCESS'; interface PostStatusesRequestSuccessAction { type: typeof POST_STATUSES_REQUEST_SUCCESS; - postStatuses: Array; + postStatuses: Array; } export const POST_STATUSES_REQUEST_FAILURE = 'POST_STATUSES_REQUEST_FAILURE'; @@ -33,7 +33,7 @@ const postStatusesRequestStart = (): PostStatusesRequestActionTypes => ({ }); const postStatusesRequestSuccess = ( - postStatuses: Array + postStatuses: Array ): PostStatusesRequestActionTypes => ({ type: POST_STATUSES_REQUEST_SUCCESS, postStatuses, diff --git a/app/javascript/actions/PostStatus/updatePostStatus.ts b/app/javascript/actions/PostStatus/updatePostStatus.ts index eef66475..6f21f7dc 100644 --- a/app/javascript/actions/PostStatus/updatePostStatus.ts +++ b/app/javascript/actions/PostStatus/updatePostStatus.ts @@ -43,24 +43,34 @@ const postStatusUpdateFailure = (error: string): PostStatusUpdateFailureAction = error, }); -export const updatePostStatus = ( - id: number, - name: string, - color: string, - authenticityToken: string, -): ThunkAction> => async (dispatch) => { +interface UpdatePostStatusParams { + id: number; + name?: string; + color?: string; + showInRoadmap?: boolean; + authenticityToken: string; +} + +export const updatePostStatus = ({ + id, + name = null, + color = null, + showInRoadmap = null, + authenticityToken, +}: UpdatePostStatusParams): ThunkAction> => async (dispatch) => { dispatch(postStatusUpdateStart()); + const post_status = Object.assign({}, + name !== null ? {name} : null, + color !== null ? {color} : null, + showInRoadmap !== null ? {show_in_roadmap: showInRoadmap} : null + ); + try { const res = await fetch(`/post_statuses/${id}`, { method: 'PATCH', headers: buildRequestHeaders(authenticityToken), - body: JSON.stringify({ - post_status: { - name, - color, - }, - }), + body: JSON.stringify({post_status}), }); const json = await res.json(); diff --git a/app/javascript/components/Comments/Comment.tsx b/app/javascript/components/Comments/Comment.tsx index 1443f1b6..194d5937 100644 --- a/app/javascript/components/Comments/Comment.tsx +++ b/app/javascript/components/Comments/Comment.tsx @@ -81,7 +81,7 @@ const Comment = ({ { isPowerUser ? - + <> handleToggleIsCommentUpdate(id, isPostUpdate)} @@ -103,7 +103,7 @@ const Comment = ({ {I18n.t('common.buttons.delete')} - + : null } diff --git a/app/javascript/components/Comments/CommentList.tsx b/app/javascript/components/Comments/CommentList.tsx index 5568e7c5..e0b081de 100644 --- a/app/javascript/components/Comments/CommentList.tsx +++ b/app/javascript/components/Comments/CommentList.tsx @@ -36,7 +36,7 @@ const CommentList = ({ isPowerUser, userEmail, }: Props) => ( - + <> {comments.map((comment, i) => { if (comment.parentId === parentId) { return ( @@ -77,7 +77,7 @@ const CommentList = ({ ); } else return null; })} - + ); export default CommentList; \ No newline at end of file diff --git a/app/javascript/components/Comments/NewComment.tsx b/app/javascript/components/Comments/NewComment.tsx index 07ebea76..0ed13b09 100644 --- a/app/javascript/components/Comments/NewComment.tsx +++ b/app/javascript/components/Comments/NewComment.tsx @@ -41,11 +41,11 @@ const NewComment = ({ isPowerUser, userEmail, }: Props) => ( - + <>
{ isLoggedIn ? - + <>