[feature] Self-serve email change for users (#2957)

* [feature] Email change

* frontend stuff for changing email

* docs

* tests etc

* differentiate more clearly between local user+account and account

* populate user
This commit is contained in:
tobi
2024-06-06 15:43:25 +02:00
committed by GitHub
parent 131020faeb
commit bcda048eab
50 changed files with 1118 additions and 309 deletions

View File

@@ -30,7 +30,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/messages"
)
func (p *Processor) AccountApprove(
func (p *Processor) SignupApprove(
ctx context.Context,
adminAcct *gtsmodel.Account,
accountID string,
@@ -55,7 +55,10 @@ func (p *Processor) AccountApprove(
if !*user.Approved {
// Process approval side effects asynschronously.
p.state.Workers.Client.Queue.Push(&messages.FromClientAPI{
APObjectType: ap.ActorPerson,
// Use ap.ObjectProfile here to
// distinguish this message (user model)
// from ap.ActorPerson (account model).
APObjectType: ap.ObjectProfile,
APActivityType: ap.ActivityAccept,
GTSModel: user,
Origin: adminAcct,

View File

@@ -42,7 +42,7 @@ func (suite *AdminApproveTestSuite) TestApprove() {
*targetUser = *suite.testUsers["unconfirmed_account"]
// Approve the sign-up.
acct, errWithCode := suite.adminProcessor.AccountApprove(
acct, errWithCode := suite.adminProcessor.SignupApprove(
ctx,
adminAcct,
targetAcct.ID,

View File

@@ -30,7 +30,7 @@ import (
"github.com/superseriousbusiness/gotosocial/internal/messages"
)
func (p *Processor) AccountReject(
func (p *Processor) SignupReject(
ctx context.Context,
adminAcct *gtsmodel.Account,
accountID string,
@@ -102,7 +102,10 @@ func (p *Processor) AccountReject(
// Process rejection side effects asynschronously.
p.state.Workers.Client.Queue.Push(&messages.FromClientAPI{
APObjectType: ap.ActorPerson,
// Use ap.ObjectProfile here to
// distinguish this message (user model)
// from ap.ActorPerson (account model).
APObjectType: ap.ObjectProfile,
APActivityType: ap.ActivityReject,
GTSModel: deniedUser,
Origin: adminAcct,

View File

@@ -42,7 +42,7 @@ func (suite *AdminRejectTestSuite) TestReject() {
message = "Too stinky."
)
acct, errWithCode := suite.adminProcessor.AccountReject(
acct, errWithCode := suite.adminProcessor.SignupReject(
ctx,
adminAcct,
targetAcct.ID,
@@ -104,7 +104,7 @@ func (suite *AdminRejectTestSuite) TestRejectRemote() {
)
// Try to reject a remote account.
_, err := suite.adminProcessor.AccountReject(
_, err := suite.adminProcessor.SignupReject(
ctx,
adminAcct,
targetAcct.ID,
@@ -126,7 +126,7 @@ func (suite *AdminRejectTestSuite) TestRejectApproved() {
)
// Try to reject an already-approved account.
_, err := suite.adminProcessor.AccountReject(
_, err := suite.adminProcessor.SignupReject(
ctx,
adminAcct,
targetAcct.ID,