Remove MakeDirectChannelVisible and add client handling for showing DMs (#5430)

Этот коммит содержится в:
Joram Wilander
2017-02-15 18:54:24 -05:00
коммит произвёл GitHub
родитель 745e2f4923
Коммит db2966b7cb
8 изменённых файлов: 61 добавлений и 104 удалений

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

@@ -80,7 +80,6 @@ func (me *msgProvider) DoCommand(c *Context, args *model.CommandArgs, message st
targetChannelId = channel.Data.(*model.Channel).Id
}
app.MakeDirectChannelVisible(targetChannelId)
if len(parsedMessage) > 0 {
post := &model.Post{}
post.Message = parsedMessage

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

@@ -1058,42 +1058,6 @@ func TestFuzzyPosts(t *testing.T) {
}
}
func TestMakeDirectChannelVisible(t *testing.T) {
th := Setup().InitBasic()
Client := th.BasicClient
team := th.BasicTeam
user1 := th.BasicUser
user2 := th.BasicUser2
th.LoginBasic2()
preferences := &model.Preferences{
{
UserId: user2.Id,
Category: model.PREFERENCE_CATEGORY_DIRECT_CHANNEL_SHOW,
Name: user1.Id,
Value: "false",
},
}
Client.Must(Client.SetPreferences(preferences))
Client.Must(Client.Logout())
th.LoginBasic()
th.BasicClient.SetTeamId(team.Id)
channel := Client.Must(Client.CreateDirectChannel(user2.Id)).Data.(*model.Channel)
if err := app.MakeDirectChannelVisible(channel.Id); err != nil {
t.Fatal(err)
}
if result, err := Client.GetPreference(model.PREFERENCE_CATEGORY_DIRECT_CHANNEL_SHOW, user2.Id); err != nil {
t.Fatal("Errored trying to set direct channel to be visible for user1")
} else if pref := result.Data.(*model.Preference); pref.Value != "true" {
t.Fatal("Failed to set direct channel to be visible for user1")
}
}
func TestGetFlaggedPosts(t *testing.T) {
th := Setup().InitBasic()
Client := th.BasicClient