Fix #854 Added ViewChannel enum and property to channel permissions (#874)

* Fix #854 Added ViewChannel enum and property to channel permissions

* replaced usages of ChannelPermission#ReadMessages with ViewChannel

* rename parameter of ChannelPermissions constructor

* made OverwritePermissions#ReadMessages obsolete, use ViewChannel instead

* Fix #854 Added ViewChannel enum and property to channel permissions

replaced usages of ChannelPermission#ReadMessages with ViewChannel

rename parameter of ChannelPermissions constructor

made OverwritePermissions#ReadMessages obsolete, use ViewChannel instead

* renamed readMessages parameter in ChannelPermissions constructor and Modify

* fixed channel permission tests to use ChannelPermission enum instead of GuildPermission enum

* replaced usages of readmessages in channel permission tests

* resolve build warnings for permission tests
This commit is contained in:
Chris Johnston
2018-01-06 19:35:17 -08:00
committed by Christopher F
parent 804d9188e7
commit edfbd055bb
9 changed files with 67 additions and 51 deletions

View File

@@ -244,7 +244,7 @@ namespace Discord.Rest
if (model == null)
return null;
var user = RestGuildUser.Create(client, guild, model);
if (!user.GetPermissions(channel).ReadMessages)
if (!user.GetPermissions(channel).ViewChannel)
return null;
return user;
@@ -265,7 +265,7 @@ namespace Discord.Rest
var models = await client.ApiClient.GetGuildMembersAsync(guild.Id, args, options).ConfigureAwait(false);
return models
.Select(x => RestGuildUser.Create(client, guild, x))
.Where(x => x.GetPermissions(channel).ReadMessages)
.Where(x => x.GetPermissions(channel).ViewChannel)
.ToImmutableArray();
},
nextPage: (info, lastPage) =>