Merge branch 'main' of ssh://github.com/pluralkit/pluralkit

This commit is contained in:
spiral
2022-06-11 00:48:09 -04:00
7 changed files with 51 additions and 28 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}.");