Skip to content

fix(preview): Ensure promoted-by field shows correct user - #3414

Merged
mergify[bot] merged 6 commits into
box:masterfrom
joshmarnold:WEBAPP-18630
Oct 3, 2023
Merged

mergify[bot] merged 6 commits into
box:masterfrom
joshmarnold:WEBAPP-18630

Conversation

@joshmarnold

@joshmarnold joshmarnold commented Sep 27, 2023 •

Copy link
Copy Markdown
Contributor

The promoted-by field displays the owner when it should display the promoter.

File2023-09-27 at 14 30 06

@joshmarnold
joshmarnold requested review from a team as code owners September 27, 2023 18:33
@joshmarnold joshmarnold changed the title fix(preview): Ensure correct promoted by field is shown fix(preview): Ensure promoted-by field shows correct user Sep 27, 2023

@greg-in-a-box greg-in-a-box left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we need some tests added since this is a bug we are trying to fix and ensure it always correct.

uploader_display_name,
}: $Shape<BoxItemVersion>): User => {
const { name, id, ...rest } = restored_by || trashed_by || modified_by || PLACEHOLDER_USER;
const { name, id, ...rest } = restored_by || trashed_by || promoted_by || modified_by || PLACEHOLDER_USER;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think we should update the test for this selector to include promoted_by. Do we need any other test to ensure that promoted_by is being used on the sidebar?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Update the test for this code to include the promoted_by. I don't see anywhere else that needs updated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was thinking having a test at this level too

<div className="bcs-VersionsItem-log" data-testid="bcs-VersionsItem-log" title={versionDisplayName}>
<FormattedMessage
{...ACTION_MAP[versionAction]}
values={{ name: versionDisplayName, versionPromoted }}
/>
</div>
because thats where its changing the sentence that will display the name you want to present

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

assuming this is the component that is shown in your image in your description

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Included this file as well

Comment thread src/utils/fields.js
FIELD_MODIFIED_BY,
FIELD_RESTORED_FROM,
FIELD_SIZE,
FIELD_PROMOTED_BY,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔤

@joshmarnold joshmarnold Sep 28, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To be fair, it's not truly alphabetical 😣

Comment thread src/utils/fields.js Outdated
FIELD_NAME,
FIELD_TYPE,
FIELD_SIZE,
FIELD_PROMOTED_BY,

@tjuanitas tjuanitas Sep 27, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

could you move to this the [...]_BY section below to keep the user fields together

FIELD_CREATED_BY,
FIELD_MODIFIED_BY,
FIELD_OWNED_BY,
FIELD_PROMOTED_BY,
FIELD_RESTORED_BY,
FIELD_TRASHED_BY,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, np

FIELD_PARENT,
FIELD_EXTENSION,
FIELD_PERMISSIONS,
FIELD_PROMOTED_BY,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

same comment about grouping with the other [...]_BY fields

@joshmarnold joshmarnold Sep 28, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This list actually is sorted alphabetically 😅

Comment thread src/constants.js Outdated
export const FIELD_NAME: 'name' = 'name';
export const FIELD_TYPE = 'type';
export const FIELD_SIZE: 'size' = 'size';
export const FIELD_PROMOTED_BY = 'promoted_by';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also near the other [...]_BY

@joshmarnold joshmarnold Sep 28, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did place this near the other "BY"s but I'm not sure I'm a fan of this "sorting" choice. Could easily be mistaken for being random order. Would prefer pure alphabetical

@tjuanitas
tjuanitas removed their request for review October 3, 2023 15:48
@mergify
mergify Bot merged commit 458fdbf into box:master Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants