mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 09:43:10 -06:00
Create initial presence on account creation
This commit is contained in:
parent
e9e932acc9
commit
66a68a3594
|
|
@ -20,6 +20,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/matrix-org/dendrite/appservice/types"
|
||||
"github.com/matrix-org/dendrite/clientapi/userutil"
|
||||
|
|
@ -30,6 +31,7 @@ import (
|
|||
"github.com/matrix-org/dendrite/userapi/storage/accounts"
|
||||
"github.com/matrix-org/dendrite/userapi/storage/devices"
|
||||
"github.com/matrix-org/dendrite/userapi/storage/presence"
|
||||
types2 "github.com/matrix-org/dendrite/userapi/types"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/matrix-org/util"
|
||||
"github.com/sirupsen/logrus"
|
||||
|
|
@ -105,6 +107,11 @@ func (a *UserInternalAPI) PerformAccountCreation(ctx context.Context, req *api.P
|
|||
return err
|
||||
}
|
||||
|
||||
lastActiveTS := int64(gomatrixserverlib.AsTimestamp(time.Now()))
|
||||
if _, err = a.PresenceDB.UpsertPresence(ctx, acc.UserID, nil, types2.Online, lastActiveTS); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
res.AccountCreated = true
|
||||
res.Account = acc
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue