MM-62751: [Shared Channels] Allow remote users to be discoverable in the create DM/GM modal (#30918)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
476b46d1d7
Коммит
c46ed6c681
@@ -44,6 +44,7 @@ func remoteClusterFields(prefix string) []string {
|
||||
prefix + "CreatorId",
|
||||
prefix + "PluginID",
|
||||
prefix + "Options",
|
||||
prefix + "LastGlobalUserSyncAt",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,7 +100,8 @@ func (s sqlRemoteClusterStore) Update(remoteCluster *model.RemoteCluster) (*mode
|
||||
DefaultTeamId = :DefaultTeamId,
|
||||
Topics = :Topics,
|
||||
PluginID = :PluginID,
|
||||
Options = :Options
|
||||
Options = :Options,
|
||||
LastGlobalUserSyncAt = :LastGlobalUserSyncAt
|
||||
WHERE RemoteId = :RemoteId AND Name = :Name`
|
||||
|
||||
if _, err := s.GetMaster().NamedExec(query, remoteCluster); err != nil {
|
||||
@@ -310,3 +312,24 @@ func (s sqlRemoteClusterStore) SetLastPingAt(remoteClusterId string) error {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s sqlRemoteClusterStore) UpdateLastGlobalUserSyncAt(remoteID string, syncAt int64) error {
|
||||
query := s.getQueryBuilder().
|
||||
Update("RemoteClusters").
|
||||
Set("LastGlobalUserSyncAt", syncAt).
|
||||
Where(sq.Eq{"RemoteId": remoteID})
|
||||
|
||||
result, err := s.GetMaster().ExecBuilder(query)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to update LastGlobalUserSyncAt for RemoteCluster")
|
||||
}
|
||||
|
||||
count, err := result.RowsAffected()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to determine rows affected")
|
||||
}
|
||||
if count == 0 {
|
||||
return fmt.Errorf("remote cluster not found: %s", remoteID)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -584,8 +584,15 @@ func (us SqlUserStore) GetEtagForAllProfiles() string {
|
||||
|
||||
func (us SqlUserStore) GetAllProfiles(options *model.UserGetOptions) ([]*model.User, error) {
|
||||
isPostgreSQL := us.DriverName() == model.DatabaseDriverPostgres
|
||||
|
||||
// Determine ordering based on Sort option - default to Username ASC for backwards compatibility
|
||||
orderBy := "Users.Username ASC"
|
||||
if options.Sort == "update_at_asc" {
|
||||
orderBy = "Users.UpdateAt ASC"
|
||||
}
|
||||
|
||||
query := us.usersQuery.
|
||||
OrderBy("Users.Username ASC").
|
||||
OrderBy(orderBy).
|
||||
Offset(uint64(options.Page * options.PerPage)).Limit(uint64(options.PerPage))
|
||||
|
||||
query = applyViewRestrictionsFilter(query, options.ViewRestrictions, true)
|
||||
@@ -599,6 +606,10 @@ func (us SqlUserStore) GetAllProfiles(options *model.UserGetOptions) ([]*model.U
|
||||
query = query.Where("Users.DeleteAt = 0")
|
||||
}
|
||||
|
||||
if options.UpdatedAfter > 0 {
|
||||
query = query.Where(sq.Gt{"Users.UpdateAt": options.UpdatedAfter})
|
||||
}
|
||||
|
||||
users := []*model.User{}
|
||||
if err := us.GetReplica().SelectBuilder(&users, query); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to get User profiles")
|
||||
|
||||
Ссылка в новой задаче
Block a user