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

Workspace - Workspace image is disappearing when navigating to the Workspace settings page - Reported by: @thesahindia #6590

Closed
isagoico opened this issue Dec 6, 2021 · 15 comments · Fixed by #6739
Assignees
Labels
Engineering Improvement Item broken or needs improvement. Reviewing Has a PR in review Weekly KSv2

Comments

@isagoico
Copy link

isagoico commented Dec 6, 2021

If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!


Action Performed:

  1. In a account with a existing Workspace, navigate to workspace settings
  2. If a avatar is not set up yet, upload an avatar to the workspace
  3. Navigate from the settings page to the Workspace settings page

Expected Result:

Workspace image should be displayed.

Actual Result:

Default workspace image is displayed instead of the uploaded avatar.

Workaround:

None needed, visual issue.

Platform:

Where is this issue occurring?

  • Web
  • iOS
  • Android
  • Desktop App
  • Mobile Web

Version Number: 1.1.17-0

Reproducible in staging?: Yes
Reproducible in production?: Yes

Logs: https://stackoverflow.com/c/expensify/questions/4856

Notes/Photos/Videos: Any additional supporting documentation

Screen.Recording.2021-12-02.at.11.48.39.PM.mov

Expensify/Expensify Issue URL:

Issue reported by: @thesahindia
Slack conversation: https://expensify.slack.com/archives/C01GTK53T8Q/p1638470766142000

View all open jobs on GitHub

@MelvinBot
Copy link

Triggered auto assignment to @ctkochan22 (Engineering), see https://stackoverflow.com/c/expensify/questions/4319 for more details.

@ctkochan22 ctkochan22 added Improvement Item broken or needs improvement. Weekly KSv2 and removed Daily KSv2 labels Dec 6, 2021
@ctkochan22
Copy link
Contributor

Logging the policy in the props within the render. Its there, and then its re-rendered without policy info. This would explain the flash where there is an avatar, then it goes missing.

@ctkochan22
Copy link
Contributor

ctkochan22 commented Dec 7, 2021

Okay, got it.

  1. WorkspaceInitialPage.js calls withFullPolicy -- here
  2. withFullPolicy gets the policy using Policy.loadFullPolicy() --> Api.GetFullPolicy()
  3. Which hits Auth's Policy::getJSONList() which throws all nameValuePairs in the object's "value" key -- here.
    AvatarURL is nested within "value"
  4. When getSimplifiedPolicyObject tries to get the avatarURL, it fails, as avatarURL is one degree nested within value -- here
active: false
id: "18C2E4F7DD4FD1DC"
lastModified: 1638839343976029
name: "Redwood Software's workspace"
outputCurrency: "USD"
owner: "[email protected]"
permissions: "read, write, share, own"
role: "admin"
type: "free"
value: {
    approvalMode: 'OPTIONAL', approver: '[email protected]', autoReporting: true, autoReportingOffset: 'lastDayOfMonth', automaticJoiningEnabled: true, …
    avatarURL: "https://d2g02b6ed2w9fz.cloudfront.net/a2953ee9df5af58a...
}

cc @marcaaron for helping point me in the right direction

@ctkochan22
Copy link
Contributor

Suggested Solution:
Originally, I was going to update getSimplifiedPolicyObject() but I realize in Auth, we also pass avatarURL in the initial list of key/value pairs returned by Policy::getJSONSummaryList() -- here

So lets just do the same for Policy::getJSONList()

@ctkochan22 ctkochan22 added the Reviewing Has a PR in review label Dec 7, 2021
@flodnv
Copy link
Contributor

flodnv commented Dec 8, 2021

Hum.... the fix for this went in the opposite direction from where we're trying to go: https://github.com/Expensify/Expensify/issues/183673

Why couldn't we just look in the value?

cc @tylerkaraszewski

@tylerkaraszewski
Copy link
Contributor

I just realized that the PR is in code below a giant comment about why we put this in alphabetical order but is not in alphabetical order.

@tylerkaraszewski
Copy link
Contributor

@ctkochan22
Copy link
Contributor

Ahh, I didn't know about that. Based on no context, it seemed like we were supposed to pass in avatarURL not in the values. Do you guys want me to make another PR to handle it on the App side?

@flodnv
Copy link
Contributor

flodnv commented Dec 8, 2021

I think the App (and for that matter, all of our API consumers) should look in value

@ctkochan22 ctkochan22 removed the Reviewing Has a PR in review label Dec 8, 2021
@ctkochan22
Copy link
Contributor

@flodnv should I revert my changes in Auth? Or can I just get away with grabbing the URL from the values now. Part of the issue is that, in getPolicySummaryList the url is available (not nested). Where as getFullPolicyList, it will be nested in values.

Are we going to make the change to getPolicySummaryList to? Or do I need to handle those two cases separately?

@flodnv
Copy link
Contributor

flodnv commented Dec 8, 2021

should I revert my changes in Auth?

Ideally yes

The 2 APIs return different things and need to be handled separately, like PHP does, for example here: https://github.com/Expensify/Web-Expensify/blob/6603eaf6d33eed299ef16a6080b54311dda0b7f8/lib/Policy.php#L1375-L1388

@thesahindia
Copy link
Member

@ctkochan22, should we keep this issue open as no job is created for reporting the issue yet.

@ctkochan22 ctkochan22 added the External Added to denote the issue can be worked on by a contributor label Dec 14, 2021
@MelvinBot
Copy link

Triggered auto assignment to @puneetlath (External), see https://stackoverflow.com/c/expensify/questions/8582 for more details.

@MelvinBot MelvinBot added Daily KSv2 and removed Weekly KSv2 labels Dec 14, 2021
@ctkochan22 ctkochan22 removed External Added to denote the issue can be worked on by a contributor Daily KSv2 labels Dec 14, 2021
@ctkochan22 ctkochan22 added the Weekly KSv2 label Dec 14, 2021
@ctkochan22 ctkochan22 reopened this Dec 14, 2021
@puneetlath
Copy link
Contributor

@thesahindia I sent you an offer in Upwork for reporting the issue. Thanks!

@puneetlath
Copy link
Contributor

Paid!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Engineering Improvement Item broken or needs improvement. Reviewing Has a PR in review Weekly KSv2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants