[MM-13671] Rework Team InviteId Creation and Updates (#10536)
* Add regenerate invite ID endpoint; Dont allow inviteID updates via other methods; Remove unrequired checks in get handler * Fix tests; Dont accept TeamId as invite ID * Ensure all teams have an InviteID set * Custom Selector to get empty teams; dont crash when inviteid set fails * Remote InviteId from TeamPatch * Add missing translation * Translation string order * Use sync store * gofmt
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ec95793b90
Коммит
f7982216e4
@@ -61,8 +61,9 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
EXIT_VERSION_SAVE = 1003
|
||||
EXIT_THEME_MIGRATION = 1004
|
||||
EXIT_VERSION_SAVE = 1003
|
||||
EXIT_THEME_MIGRATION = 1004
|
||||
EXIT_TEAM_INVITEID_MIGRATION_FAILED = 1006
|
||||
)
|
||||
|
||||
// UpgradeDatabase attempts to migrate the schema to the latest supported version.
|
||||
@@ -660,6 +661,19 @@ func UpgradeDatabaseToVersion511(sqlStore SqlStore) {
|
||||
// TODO: Uncomment following condition when version 5.11.0 is released
|
||||
// if shouldPerformUpgrade(sqlStore, VERSION_5_10_0, VERSION_5_11_0) {
|
||||
|
||||
// Enforce all teams have an InviteID set
|
||||
var teams []*model.Team
|
||||
if _, err := sqlStore.GetReplica().Select(&teams, "SELECT * FROM Teams WHERE InviteId = ''"); err != nil {
|
||||
mlog.Error("Error fetching Teams without InviteID: " + err.Error())
|
||||
} else {
|
||||
for _, team := range teams {
|
||||
team.InviteId = model.NewId()
|
||||
if _, err := sqlStore.Team().Update(team); err != nil {
|
||||
mlog.Error("Error updating Team InviteIDs: " + err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// saveSchemaVersion(sqlStore, VERSION_5_11_0)
|
||||
// }
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user