Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GoalsActions] Fix user updating during project creation #693

Merged
merged 13 commits into from
Sep 8, 2020

Conversation

imnasnainaec
Copy link
Collaborator

@imnasnainaec imnasnainaec commented Sep 4, 2020

  • Fix Axios response interceptor
  • Move update of user with a new userEdit from GoalsActions in the frontend to UserEditController in the backend

Fixes #691 , Fixes #692


This change is Reviewable

@imnasnainaec imnasnainaec self-assigned this Sep 4, 2020
@johnthagen
Copy link
Collaborator


src/components/GoalTimeline/GoalsActions.tsx, line 73 at r1 (raw file):

    await Backend.createUserEdit()
      .then(async (userEditId: string) => {
        const LocalUser = LocalStorage.getCurrentUser();

localUser to match style guide.

Copy link
Collaborator Author

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @imnasnainaec and @johnthagen)


src/components/GoalTimeline/GoalsActions.tsx, line 73 at r1 (raw file):

Previously, johnthagen wrote…

localUser to match style guide.

But I was 2 for 2: #692 (comment)

Fixed.

@johnthagen
Copy link
Collaborator

@imnasnainaec I am still getting a forbidden when I execute the steps in #691 from a clean database

@imnasnainaec
Copy link
Collaborator Author

imnasnainaec commented Sep 4, 2020

@imnasnainaec I am still getting a forbidden when I execute the steps in #691 from a clean database

@johnthagen Ah, I forgot to check the fix with a new user.

@imnasnainaec
Copy link
Collaborator Author

@imnasnainaec I am still getting a forbidden when I execute the steps in #691 from a clean database

@johnthagen Ah, I forgot to check the fix with a new user.

@johnthagen Rather, I didn't see the error because I was testing with an admin user.

@imnasnainaec imnasnainaec marked this pull request as draft September 4, 2020 18:47
@imnasnainaec imnasnainaec marked this pull request as ready for review September 4, 2020 21:53
@imnasnainaec imnasnainaec changed the title [GoalsActions] Update user from backend instead of from LocalStorage [GoalsActions] Fix user updating during project creation Sep 4, 2020
@johnthagen
Copy link
Collaborator


src/backend/index.tsx, line 23 at r4 (raw file):

backendServer.interceptors.response.use(
  (resp) => {
    if (resp.data.__UpdatedUser) {

This is where silent conversion to boolean really bit us. I bet this was set to undefined rather than null or something, and so we never took this code path even though we meant to check for null rather than undefined?

@johnthagen
Copy link
Collaborator


src/components/GoalTimeline/GoalsActions.tsx, line 72 at r4 (raw file):

  return async (dispatch: ThunkDispatch<StoreState, any, GoalAction>) => {
    const user: User | null = LocalStorage.getCurrentUser();
    const projectId: string = LocalStorage.getProjectId();

Could we strip away these extra type annotations that can be inferred by the compiler/IDE per our style guide?

Copy link
Collaborator

@johnthagen johnthagen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 6 of 6 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @imnasnainaec)

@johnthagen
Copy link
Collaborator

I have confirmed that this solves the issue I reported in #691

Copy link
Collaborator Author

@imnasnainaec imnasnainaec left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 5 of 6 files reviewed, all discussions resolved (waiting on @johnthagen)


src/components/GoalTimeline/GoalsActions.tsx, line 72 at r4 (raw file):

Previously, johnthagen wrote…

Could we strip away these extra type annotations that can be inferred by the compiler/IDE per our style guide?

Done

@jasonleenaylor jasonleenaylor merged commit a5ce253 into master Sep 8, 2020
@jasonleenaylor jasonleenaylor deleted the update-user-from-backend branch September 8, 2020 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants