add "user/invites/sent" and "user/invites/received" requests
All checks were successful
Server Build / publish (push) Successful in 29s
Voice Build / publish (push) Successful in 25s

This commit is contained in:
olcxja 2026-05-21 08:29:13 +02:00
commit 93fd8312da
4 changed files with 49 additions and 11 deletions

View file

@ -37,16 +37,14 @@ public class Requests
try
{
string inviteFile = ACCOUNTS_DATA_DIR + $"/{id2}/dminvites/recv/{id};{DOMAIN}";
string inviteFile = ACCOUNTS_DATA_DIR + $"/{id2}/dminvites/recv/{id}";
if (Fs.Exists(inviteFile))
{
return "info:user.already.invited";
}
await Fs.WriteFile(inviteFile, Encoding.UTF8.GetBytes("0"));
//im not saving this like ts is litterally local scenario
//await Fs.WriteFile(inviteSentFile, []); //we should also save that this user invited someone, because this will act as dm accept verification while federating
await Fs.WriteFile(ACCOUNTS_DATA_DIR + $"/{id}/dminvites/sent/{id2}", []); //we should also save that this user invited someone, because listing sent invites is cool
}
finally
{
@ -81,14 +79,13 @@ public class Requests
if (isUserLocal)
{
/*
string inviteSentFile = ACCOUNTS_DATA_DIR + $"/{id2}/dminvites/sent/{id};{DOMAIN}";
string inviteSentFile = ACCOUNTS_DATA_DIR + $"/{id2}/dminvites/sent/{id}";
if (!Fs.Exists(inviteSentFile))
{
return "You can't create a DM without an invitation";
return "error:cant.create.dm.without.invitation";
}
Fs.DeleteFile(inviteSentFile);
*/ // local scenario, there is no need to check sent
}
else //check sent on federated server
{
@ -98,7 +95,7 @@ public class Requests
}
}
string inviteFile = ACCOUNTS_DATA_DIR + $"/{id}/dminvites/recv/{id2};{domain}";
string inviteFile = $"{ACCOUNTS_DATA_DIR}/{id}/dminvites/recv/{id2}" + (isUserLocal ? "" : $";{domain}");
if (Fs.Exists(inviteFile))
{