mirror of
https://github.com/pushbits/server.git
synced 2025-07-19 01:17:41 +02:00
Add option to control repair behavior
This commit is contained in:
parent
38b615a05d
commit
77765e77a9
9 changed files with 49 additions and 22 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/pushbits/server/internal/authentication/credentials"
|
||||
"github.com/pushbits/server/internal/configuration"
|
||||
"github.com/pushbits/server/internal/log"
|
||||
"github.com/pushbits/server/internal/model"
|
||||
|
||||
|
@ -111,7 +112,7 @@ func (d *Database) Populate(name, password, matrixID string) error {
|
|||
}
|
||||
|
||||
// RepairChannels resets channels that have been modified by a user.
|
||||
func (d *Database) RepairChannels(dp Dispatcher) error {
|
||||
func (d *Database) RepairChannels(dp Dispatcher, behavior *configuration.RepairBehavior) error {
|
||||
log.L.Print("Repairing application channels.")
|
||||
|
||||
users, err := d.GetUsers()
|
||||
|
@ -130,7 +131,7 @@ func (d *Database) RepairChannels(dp Dispatcher) error {
|
|||
for _, application := range applications {
|
||||
application := application // See https://stackoverflow.com/a/68247837
|
||||
|
||||
if err := dp.UpdateApplication(&application); err != nil {
|
||||
if err := dp.UpdateApplication(&application, behavior); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue