Update email invite flag

This commit is contained in:
Dennis Reimann
2025-05-28 13:59:16 +02:00
parent 49653c3388
commit 5b2b6d6994
3 changed files with 9 additions and 5 deletions

View File

@@ -28,8 +28,8 @@ namespace BTCPayServer.Client.Models
public bool? IsAdministrator { get; set; }
/// <summary>
/// Flag to specify if email invitation should be sent to the user. https://github.com/btcpayserver/btcpayserver/issues/6406#issuecomment-2886252217
/// Flag to specify if an email invitation should be sent to the user.
/// </summary>
public bool? SkipEmailInvite { get; set; }
public bool? SendInvitationEmail { get; set; } = true;
}
}

View File

@@ -358,8 +358,6 @@ namespace BTCPayServer.Controllers.Greenfield
Created = DateTimeOffset.UtcNow,
Approved = isAdmin // auto-approve first admin and users created by an admin
};
if (request.SkipEmailInvite == true)
user.RequiresEmailConfirmation = false;
var blob = user.GetBlob() ?? new();
blob.Name = request.Name;
@@ -418,7 +416,7 @@ namespace BTCPayServer.Controllers.Greenfield
var currentUser = await _userManager.GetUserAsync(User);
var userEvent = currentUser switch
{
{ } invitedBy => await UserEvent.Invited.Create(user, invitedBy, _callbackGenerator, Request, true),
{ } invitedBy => await UserEvent.Invited.Create(user, invitedBy, _callbackGenerator, Request, request.SendInvitationEmail is not false),
_ => await UserEvent.Registered.Create(user, _callbackGenerator, Request)
};
_eventAggregator.Publish(userEvent);

View File

@@ -271,6 +271,12 @@
"description": "Make this user administrator (only if you have the `unrestricted` permission of a server administrator)",
"nullable": true,
"default": false
},
"sendInvitationEmail": {
"type": "boolean",
"description": "Flag to specify if an email invitation should be sent to the user",
"nullable": true,
"default": true
}
}
}