fix(bot): make proxy/log blacklists work properly with threads
Handling of both blacklists was inconsistent when dealing with threads: - proxy blacklist of root channel blacklists all threads - log blacklist of root channel _did not apply_ to threads - couldn't proxy blacklist threads while leaving root channel proxyable This change fixes the inconsistencies: - proxy _and_ log blacklist of root channel affects all threads - now able to individually proxy/log blacklist threads, with root channel unaffected
This commit is contained in:
@@ -229,9 +229,12 @@ public class ProxyService
|
||||
if (originalMsg == null)
|
||||
throw new PKError("Could not reproxy message.");
|
||||
|
||||
var messageChannel = await _rest.GetChannelOrNull(msg.Channel!);
|
||||
var rootChannel = messageChannel.IsThread() ? await _rest.GetChannelOrNull(messageChannel.ParentId!.Value) : messageChannel;
|
||||
|
||||
// Get a MessageContext for the original message
|
||||
MessageContext ctx =
|
||||
await _repo.GetMessageContext(msg.Sender, msg.Guild!.Value, msg.Channel);
|
||||
await _repo.GetMessageContext(msg.Sender, msg.Guild!.Value, rootChannel.Id, msg.Channel);
|
||||
|
||||
// Make sure proxying is enabled here
|
||||
if (ctx.InBlacklist)
|
||||
@@ -250,8 +253,6 @@ public class ProxyService
|
||||
ProxyTags = member.ProxyTags.FirstOrDefault(),
|
||||
};
|
||||
|
||||
var messageChannel = await _rest.GetChannelOrNull(msg.Channel!);
|
||||
var rootChannel = messageChannel.IsThread() ? await _rest.GetChannelOrNull(messageChannel.ParentId!.Value) : messageChannel;
|
||||
var threadId = messageChannel.IsThread() ? messageChannel.Id : (ulong?)null;
|
||||
var guild = await _rest.GetGuildOrNull(msg.Guild!.Value);
|
||||
var guildMember = await _rest.GetGuildMember(msg.Guild!.Value, trigger.Author.Id);
|
||||
|
Reference in New Issue
Block a user