Compare commits

..

No commits in common. "e85a61607e5fd5f37dcab5cbd324a45aeec48664" and "be9436676305baa7377fa099e405fece8342b7ae" have entirely different histories.

3 changed files with 8 additions and 8 deletions

View File

@ -65,7 +65,8 @@ public class Behaver
internal bool IsSelf(Guid AccountId)
{
var acc = Rememberer.SearchAccount(a => a.Id == AccountId);
var db = new ChattingContext();
var acc = db.Accounts.Find(AccountId);
return SelfAccounts.Any(acc => acc.Id == AccountId);
}

View File

@ -142,9 +142,8 @@ public class TwitchInterface
private Account UpsertAccount(string username, Channel inChannel)
{
Console.WriteLine($"upserting twitch account. username: {username}. inChannel: {inChannel?.Id}");
var acc = Rememberer.SearchAccount(ui => ui.ExternalId == username && ui.SeenInChannel.ExternalId == inChannel.ExternalId);
Console.WriteLine($"upserting twitch account, retrieved {acc?.Id}.");
var acc = Rememberer.SearchAccount(ui => ui.ExternalId == username && ui.SeenInChannel.ExternalId == inChannel.ToString());
Console.WriteLine($"upserting account, retrieved {acc?.Id}.");
if (acc != null)
{
Console.WriteLine($"acc's usser: {acc.IsUser?.Id}");
@ -205,7 +204,7 @@ public class TwitchInterface
c.SendFile = (f, t) => { throw new InvalidOperationException($"twitch cannot send files"); };
c = Rememberer.RememberChannel(c);
var selfAccountInChannel = c.Users?.FirstOrDefault(a => a.ExternalId == selfAccountInProtocol.ExternalId);
var selfAccountInChannel = c.Users?.FirstOrDefault(a => a.ExternalId == selfAccountInProtocol.ExternalId.ToString());
if(selfAccountInChannel == null)
{
selfAccountInChannel = UpsertAccount(selfAccountInProtocol.Username, c);
@ -248,7 +247,7 @@ Channel c = Rememberer.SearchChannel(ci => ci.ExternalId == $"w_{whisperWith}"
c.SendFile = (f, t) => { throw new InvalidOperationException($"twitch cannot send files"); };
c = Rememberer.RememberChannel(c);
var selfAccountInChannel = c.Users.FirstOrDefault(a => a.ExternalId == selfAccountInProtocol.ExternalId);
var selfAccountInChannel = c.Users.FirstOrDefault(a => a.ExternalId == selfAccountInProtocol.ExternalId.ToString());
if(selfAccountInChannel == null)
{
selfAccountInChannel = UpsertAccount(selfAccountInChannel.Username, c);

View File

@ -13,7 +13,7 @@ public static class Rememberer
{
Account toReturn;
dbAccessSemaphore.Wait();
toReturn = db.Accounts?.Include(a => a.IsUser)?.FirstOrDefault(predicate);
toReturn = db.Accounts.Include(a => a.IsUser).FirstOrDefault(predicate);
dbAccessSemaphore.Release();
return toReturn;
}