Open platform to collect and prioritize feedback
refactor and fix test
goenning44de22f632d0
diff --git a/app/middlewares/jwt_test.go b/app/middlewares/jwt_test.goindex b2bd07c53..fc6f893ab 100644--- a/app/middlewares/jwt_test.go+++ b/app/middlewares/jwt_test.go@@ -54,6 +54,7 @@ func TestJwtGetter_WithCookie(t *testing.T) {Users: users,})server.Context.SetTenant(tenant)+ server.Context.Request().Header.Add("Accept", "application/json")server.Context.Request().AddCookie(&http.Cookie{Name: "auth",Value: token,diff --git a/public/shared/Common.tsx b/public/shared/Common.tsxindex da31ba1b7..2f1d29782 100644--- a/public/shared/Common.tsx+++ b/public/shared/Common.tsx@@ -56,21 +56,21 @@ interface IdeaResponseProps {}export const ShowIdeaResponse = (props: IdeaResponseProps): JSX.Element => {- const status = IdeaStatus.Get(props.status);+ const status = IdeaStatus.Get(props.status);- if (props.response && status.show) {- return <div className="fdr-response item ui raised segment">- <IdeaStatusRibbon status={status} />- <div className="info">- <Gravatar email={props.response.user.email}/> <u>{props.response.user.name}</u>- <span title={props.response.respondedOn.toString()}>- { moment(props.response.respondedOn).fromNow() }- </span>- </div>- <div className="content">- <MultiLineText text={ props.response.text } />- </div>- </div>;- }- return <div/>;+ if (props.response && status.show) {+ return <div className="fdr-response item ui raised segment">+ <IdeaStatusRibbon status={status} />+ <div className="info">+ <Gravatar email={props.response.user.email}/> <u>{props.response.user.name}</u>+ <span title={props.response.respondedOn.toString()}>+ { moment(props.response.respondedOn).fromNow() }+ </span>+ </div>+ <div className="content">+ <MultiLineText text={ props.response.text } />+ </div>+ </div>;+ }+ return <div/>;};diff --git a/public/shared/ResponseForm.tsx b/public/shared/ResponseForm.tsxindex 5e8a30e80..40b7e4284 100644--- a/public/shared/ResponseForm.tsx+++ b/public/shared/ResponseForm.tsx@@ -29,15 +29,15 @@ export class ResponseForm extends React.Component<ResponseFormProps, ResponseForprivate async submit() {try {- await axios.post(`/api/ideas/${this.props.idea.number}/status`, {- status: parseInt(this.status.value, 10),- text: this.text.value- });- location.reload();+ await axios.post(`/api/ideas/${this.props.idea.number}/status`, {+ status: parseInt(this.status.value, 10),+ text: this.text.value+ });+ location.reload();} catch (ex) {- this.setState({- error: ex.response.data- });+ this.setState({+ error: ex.response.data+ });}}diff --git a/public/shared/SocialSignInButton.tsx b/public/shared/SocialSignInButton.tsxindex d64095ade..a84c2c056 100644--- a/public/shared/SocialSignInButton.tsx+++ b/public/shared/SocialSignInButton.tsx@@ -30,7 +30,7 @@ export class SocialSignInButton extends React.Component<SocialSignInButtonProps,if (this.props.size === 'small') {return <a href={oauthUrl} className={cssClasses} onClick={() => this.setState({clicked: true})}><i className={providerClassName + ' icon'}></i>- </a>;+ </a>;} else {return <a href={oauthUrl} className={cssClasses} onClick={() => this.setState({clicked: true})}><i className={providerClassName + ' icon'}></i>diff --git a/public/site/ShowIdeaPage.tsx b/public/site/ShowIdeaPage.tsxindex 95daa0203..aab9603fc 100644--- a/public/site/ShowIdeaPage.tsx+++ b/public/site/ShowIdeaPage.tsx@@ -1,6 +1,6 @@import * as moment from 'moment';import * as React from 'react';-import * as storage from '../storage';+import { getCurrentUser, get, getArray, isStaff } from '../storage';import { User, Comment, Idea } from '../models';import { CommentInput } from '../shared/CommentInput';@@ -21,9 +21,9 @@ export class ShowIdeaPage extends React.Component<{}, {}> {constructor(props: {}) {super(props);- this.user = storage.getCurrentUser();- this.idea = storage.get<Idea>('idea');- this.comments = storage.getArray<Comment>('comments');+ this.user = getCurrentUser();+ this.idea = get<Idea>('idea');+ this.comments = getArray<Comment>('comments');}public render() {@@ -73,7 +73,7 @@ export class ShowIdeaPage extends React.Component<{}, {}> {<ShowIdeaResponse status={ this.idea.status } response={ this.idea.response } />{- storage.isStaff() &&+ isStaff() &&<div><div className="ui hidden divider"></div><ResponseForm idea={ this.idea } />