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

[no ticket][risk=no] Supplemented creator information #8969

Merged
merged 32 commits into from
Dec 10, 2024
Merged

Conversation

evrii
Copy link
Collaborator

@evrii evrii commented Nov 22, 2024

Currently, the get workspace endpoint only gets the creator's username. It would be helpful to get the creator's first name and last name, so that non-creator's can have a better idea as to how to contact the creator.


PR checklist

  • I have included an issue ID or "no ticket" in the PR title as outlined in CONTRIBUTING.md.
  • I have included a risk tag of the form [risk=no|low|moderate|severe] in the PR title as outlined in CONTRIBUTING.md.
  • I have manually tested this change and my testing process is described above.
  • This change includes appropriate automated tests, and I have documented any behavior that cannot be tested with code.
  • I have added explanatory comments where the logic is not obvious.
  • One or more of the following is true:
    • This change is intended to complete a JIRA story, so I have checked that all AC are met for that story.
    • This change fixes a bug, so I have ensured the steps to reproduce are in the Jira ticket or provided above.
    • This change impacts deployment safety (e.g. removing/altering APIs which are in use), so I have documented the impacts in the description.
    • This change includes a new feature flag, so I have created and linked new JIRA tickets to (a) turn on the feature flag and (b) remove it later.
    • This change modifies the UI, so I have taken screenshots or recordings of the new behavior and notified the PO and UX designer in Slack.
    • This change modifies API behavior, so I have run the relevant E2E tests locally because API changes are not covered by our PR checks.
    • None of the above apply to this change.

@evrii evrii changed the title Eric/owner info [no ticket][risk=no] Supplemented creator information Nov 22, 2024
@evrii evrii marked this pull request as ready for review November 22, 2024 19:01
@@ -14,7 +14,7 @@ public enum WorkspaceTargetProperty implements ModelBackedTargetProperty<Workspa
TERRA_NAME("terra_name", Workspace::getTerraName),
NAMESPACE("namespace", Workspace::getNamespace),
CDR_VERSION_ID("cdr_version_id", Workspace::getCdrVersionId),
CREATOR("creator", Workspace::getCreator),
CREATOR("creator", workspace -> workspace.getCreator().getEmail()),
Copy link
Collaborator

@jmthibault79 jmthibault79 Dec 9, 2024

Choose a reason for hiding this comment

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

please switch to getUserName() because email is deprecated. We want to stop using "email" in most cases because it's ambiguous (contact email or username?) and we sometimes get it wrong.

I have a new PR to remove it (and also update UserRole): #8989

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks for pointing this out

@@ -48,7 +48,8 @@ public interface WorkspaceMapper {
@Mapping(target = "displayName", source = "dbWorkspace.name")
@Mapping(target = "terraName", source = "fcWorkspace.name")
@Mapping(target = "googleBucketName", source = "fcWorkspace.bucketName")
@Mapping(target = "creator", source = "dbWorkspace.creator.username")
@Mapping(target = "creator.userName", source = "dbWorkspace.creator.username")
@Mapping(target = "creator.email", ignore = true) // need to work with security before exposing
Copy link
Collaborator

Choose a reason for hiding this comment

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

when we do get this approval, I want to use a new field like contactEmail or institutionalEmail, to be explicit about which email it is

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call, I added a comment.

@@ -124,7 +125,8 @@ default List<WorkspaceResponse> toApiWorkspaceResponseList(
ResearchPurpose workspaceToResearchPurpose(DbWorkspace dbWorkspace);

@Mapping(target = "cdrVersionId", source = "cdrVersion")
@Mapping(target = "creator", source = "creator.username")
@Mapping(target = "creator.userName", source = "creator.username") // need to work with security before exposing
Copy link
Collaborator

Choose a reason for hiding this comment

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

the comment belongs on the next line

@@ -113,14 +114,17 @@ public void setUp() {
.researchOutcomeList(Collections.emptyList());
final long now = System.currentTimeMillis();

User creator = new User();
creator.setEmail("[email protected]");
Copy link
Collaborator

Choose a reason for hiding this comment

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

-> userName

@@ -16,6 +17,8 @@ class TargetPropertyExtractorTest {
@BeforeEach
void setUp() {
long now = System.currentTimeMillis();
User creator = new User();
creator.setEmail("[email protected]");
Copy link
Collaborator

Choose a reason for hiding this comment

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

userName

@@ -119,6 +120,12 @@ public static Workspace createWorkspace(
List<ResearchOutcomeEnum> ResearchOutcomeEnumsList = new ArrayList<>();
ResearchOutcomeEnumsList.add(ResearchOutcomeEnum.IMPROVED_RISK_ASSESMENT);

User creator = new User();
creator.setEmail("[email protected]");
Copy link
Collaborator

Choose a reason for hiding this comment

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

rm, to ensure that this field is not actually what we're reading

@@ -494,8 +494,8 @@ export const WorkspaceShare = fp.flow(withUserProfile())(
>
When you share this workspace as a ‘Writer’ or an ‘Owner’,
the initial credits of the creator of the workspace (
{this.props.workspace.creator}) will be used for all
analysis in this workspace.
{this.props.workspace.creator.userName}) will be used for
Copy link
Collaborator

Choose a reason for hiding this comment

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

there are a few other instances of this which need changing:

  • EnvironmentInformedActionPanel
  • BasicInformation

@@ -7278,7 +7278,7 @@ components:
cdrVersionId:
type: string
creator:
type: string
$ref: '#/components/schemas/User'
Copy link
Collaborator

Choose a reason for hiding this comment

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

unfortunately this is not deployment-safe: when the API is deployed with this change, there's a period of time when the UI will be expecting a string here, before the UI is also updated.

Adding a field (maybe creatorUser?) and later deleting the original creator after a release would solve this issue.

@evrii evrii merged commit f57e48a into main Dec 10, 2024
7 checks passed
@evrii evrii deleted the eric/ownerInfo branch December 10, 2024 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants