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

Project managers invited by email can create projects #1300

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions backend/LexBoxApi/Services/EmailService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
string? language = null)
{
language ??= User.DefaultLocalizationCode;
var authUser = CreateUserForInvite(emailAddress, language);
var authUser = CreateUserForInvite(emailAddress, language, canCreateProjects: orgRole == OrgRole.Admin);
authUser.Orgs = [new AuthUserOrg(orgRole, orgId)];
await SendInvitationEmail(authUser, emailAddress, managerName, orgName, language, isProjectInvitation: false);

Expand All @@ -124,12 +124,12 @@
string? language = null)
{
language ??= User.DefaultLocalizationCode;
var authUser = CreateUserForInvite(emailAddress, language);
var authUser = CreateUserForInvite(emailAddress, language, canCreateProjects: role == ProjectRole.Manager);
authUser.Projects = [new AuthUserProject(role, projectId)];
await SendInvitationEmail(authUser, emailAddress, managerName, projectName, language, isProjectInvitation: true);

}
private LexAuthUser CreateUserForInvite(string emailAddress, string? language)
private LexAuthUser CreateUserForInvite(string emailAddress, string? language, bool canCreateProjects = false)
{
language ??= User.DefaultLocalizationCode;
return new LexAuthUser
Expand All @@ -141,7 +141,7 @@
EmailVerificationRequired = null,
Role = UserRole.user,
UpdatedDate = DateTimeOffset.Now.ToUnixTimeSeconds(),
CanCreateProjects = null,
CanCreateProjects = canCreateProjects ? true : null,
Locale = language,
Locked = null,
Projects = [],
Expand Down Expand Up @@ -235,7 +235,7 @@
}
catch (Exception e)
{
activity?.RecordException(e);

Check warning on line 238 in backend/LexBoxApi/Services/EmailService.cs

View workflow job for this annotation

GitHub Actions / Build API / publish-api

'ActivityExtensions.RecordException(Activity?, Exception?)' is obsolete: 'Call Activity.AddException instead this method will be removed in a future version.'

Check warning on line 238 in backend/LexBoxApi/Services/EmailService.cs

View workflow job for this annotation

GitHub Actions / GHA integration tests / execute

'ActivityExtensions.RecordException(Activity?, Exception?)' is obsolete: 'Call Activity.AddException instead this method will be removed in a future version.'
activity?.SetStatus(ActivityStatusCode.Error);
throw;
}
Expand Down
Loading