PLT-3512 adding join/leave channel to the CLI (#3498)
* PLT-3512 adding join/leave channel to the CLI * PLT-3512 adding list channels to the CLI * PLT-3512 adding restore channel * Adding make run-cli command * Updating txt * Fixing txt purposed by PMs
Этот коммит содержится в:
коммит произвёл
Christopher Speller
родитель
26c91e73fe
Коммит
b1520d0b94
@@ -289,12 +289,16 @@ func (s SqlChannelStore) get(id string, master bool) StoreChannel {
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) Delete(channelId string, time int64) StoreChannel {
|
||||
return s.SetDeleteAt(channelId, time, time)
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) SetDeleteAt(channelId string, deleteAt int64, updateAt int64) StoreChannel {
|
||||
storeChannel := make(StoreChannel)
|
||||
|
||||
go func() {
|
||||
result := StoreResult{}
|
||||
|
||||
_, err := s.GetMaster().Exec("Update Channels SET DeleteAt = :Time, UpdateAt = :Time WHERE Id = :ChannelId", map[string]interface{}{"Time": time, "ChannelId": channelId})
|
||||
_, err := s.GetMaster().Exec("Update Channels SET DeleteAt = :DeleteAt, UpdateAt = :UpdateAt WHERE Id = :ChannelId", map[string]interface{}{"DeleteAt": deleteAt, "UpdateAt": updateAt, "ChannelId": channelId})
|
||||
if err != nil {
|
||||
result.Err = model.NewLocAppError("SqlChannelStore.Delete", "store.sql_channel.delete.channel.app_error", nil, "id="+channelId+", err="+err.Error())
|
||||
}
|
||||
@@ -948,6 +952,28 @@ func (s SqlChannelStore) GetForExport(teamId string) StoreChannel {
|
||||
return storeChannel
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) GetAll(teamId string) StoreChannel {
|
||||
storeChannel := make(StoreChannel)
|
||||
|
||||
go func() {
|
||||
result := StoreResult{}
|
||||
|
||||
var data []*model.Channel
|
||||
_, err := s.GetReplica().Select(&data, "SELECT * FROM Channels WHERE TeamId = :TeamId AND Type != 'D' ORDER BY Name", map[string]interface{}{"TeamId": teamId})
|
||||
|
||||
if err != nil {
|
||||
result.Err = model.NewLocAppError("SqlChannelStore.GetAll", "store.sql_channel.get_all.app_error", nil, "teamId="+teamId+", err="+err.Error())
|
||||
} else {
|
||||
result.Data = data
|
||||
}
|
||||
|
||||
storeChannel <- result
|
||||
close(storeChannel)
|
||||
}()
|
||||
|
||||
return storeChannel
|
||||
}
|
||||
|
||||
func (s SqlChannelStore) AnalyticsTypeCount(teamId string, channelType string) StoreChannel {
|
||||
storeChannel := make(StoreChannel)
|
||||
|
||||
|
||||
@@ -200,6 +200,15 @@ func TestChannelStoreGet(t *testing.T) {
|
||||
t.Fatal("invalid returned channel")
|
||||
}
|
||||
}
|
||||
|
||||
if r3 := <-store.Channel().GetAll(o1.TeamId); r3.Err != nil {
|
||||
t.Fatal(r3.Err)
|
||||
} else {
|
||||
channels := r3.Data.([]*model.Channel)
|
||||
if len(channels) == 0 {
|
||||
t.Fatal("too little")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestChannelStoreDelete(t *testing.T) {
|
||||
|
||||
@@ -77,12 +77,14 @@ type ChannelStore interface {
|
||||
Get(id string) StoreChannel
|
||||
GetFromMaster(id string) StoreChannel
|
||||
Delete(channelId string, time int64) StoreChannel
|
||||
SetDeleteAt(channelId string, deleteAt int64, updateAt int64) StoreChannel
|
||||
PermanentDeleteByTeam(teamId string) StoreChannel
|
||||
GetByName(team_id string, domain string) StoreChannel
|
||||
GetChannels(teamId string, userId string) StoreChannel
|
||||
GetMoreChannels(teamId string, userId string) StoreChannel
|
||||
GetChannelCounts(teamId string, userId string) StoreChannel
|
||||
GetForExport(teamId string) StoreChannel
|
||||
GetAll(teamId string) StoreChannel
|
||||
|
||||
SaveMember(member *model.ChannelMember) StoreChannel
|
||||
UpdateMember(member *model.ChannelMember) StoreChannel
|
||||
|
||||
Ссылка в новой задаче
Block a user