fix: a couple more minor reproxy fixes

This commit is contained in:
Ske
2022-06-06 00:59:53 +02:00
parent 6511c04c6c
commit 51fb561841
4 changed files with 12 additions and 10 deletions

View File

@@ -140,13 +140,12 @@ public class ProxiedMessage
var editType = isReproxy ? "reproxy" : "edit";
var editTypeAction = isReproxy ? "reproxied" : "edited";
// todo: is it correct to get a connection here?
await using var conn = await ctx.Database.Obtain();
FullMessage? msg = null;
var (referencedMessage, _) = ctx.MatchMessage(false);
if (referencedMessage != null)
{
await using var conn = await ctx.Database.Obtain();
msg = await ctx.Repository.GetMessage(conn, referencedMessage.Value);
if (msg == null)
throw new PKError("This is not a message proxied by PluralKit.");
@@ -161,6 +160,7 @@ public class ProxiedMessage
if (recent == null)
throw new PKSyntaxError($"Could not find a recent message to {editType}.");
await using var conn = await ctx.Database.Obtain();
msg = await ctx.Repository.GetMessage(conn, recent.Mid);
if (msg == null)
throw new PKSyntaxError($"Could not find a recent message to {editType}.");