-
Notifications
You must be signed in to change notification settings - Fork 10
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
Conversation
@@ -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()), |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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]"); |
There was a problem hiding this comment.
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]"); |
There was a problem hiding this comment.
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]"); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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.
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
[risk=no|low|moderate|severe]
in the PR title as outlined in CONTRIBUTING.md.