Migrates Channel.GetByName to sync by default (#11187)

* Channel.GetByName and Channel.GetByNameIncludedDeleted sync by default

* Suggested changes

* Fix some vars shadowing

* Rename of vars inside goroutine

* Shadow variable corrected
Этот коммит содержится в:
Rodrigo Villablanca Vásquez
2019-06-20 09:21:36 -04:00
коммит произвёл Jesús Espino
родитель 4494a56162
Коммит 59e7bf1c23
14 изменённых файлов: 165 добавлений и 143 удалений

Просмотреть файл

@@ -162,7 +162,9 @@ func TestJoinDefaultChannelsCreatesChannelMemberHistoryRecordTownSquare(t *testi
defer th.TearDown()
// figure out the initial number of users in town square
townSquareChannelId := store.Must(th.App.Srv.Store.Channel().GetByName(th.BasicTeam.Id, "town-square", true)).(*model.Channel).Id
channel, err := th.App.Srv.Store.Channel().GetByName(th.BasicTeam.Id, "town-square", true)
require.Nil(t, err)
townSquareChannelId := channel.Id
initialNumTownSquareUsers := len(store.Must(th.App.Srv.Store.ChannelMemberHistory().GetUsersInChannelDuring(model.GetMillis()-100, model.GetMillis()+100, townSquareChannelId)).([]*model.ChannelMemberHistoryResult))
// create a new user that joins the default channels
@@ -188,7 +190,9 @@ func TestJoinDefaultChannelsCreatesChannelMemberHistoryRecordOffTopic(t *testing
defer th.TearDown()
// figure out the initial number of users in off-topic
offTopicChannelId := store.Must(th.App.Srv.Store.Channel().GetByName(th.BasicTeam.Id, "off-topic", true)).(*model.Channel).Id
channel, err := th.App.Srv.Store.Channel().GetByName(th.BasicTeam.Id, "off-topic", true)
require.Nil(t, err)
offTopicChannelId := channel.Id
initialNumTownSquareUsers := len(store.Must(th.App.Srv.Store.ChannelMemberHistory().GetUsersInChannelDuring(model.GetMillis()-100, model.GetMillis()+100, offTopicChannelId)).([]*model.ChannelMemberHistoryResult))
// create a new user that joins the default channels
@@ -453,7 +457,7 @@ func TestAddChannelMemberNoUserRequestor(t *testing.T) {
assert.Equal(t, groupUserIds, channelMemberHistoryUserIds)
postList, err := th.App.Srv.Store.Post().GetPosts(channel.Id, 0, 1, false)
require.Nil(t,err)
require.Nil(t, err)
if assert.Len(t, postList.Order, 1) {
post := postList.Posts[postList.Order[0]]