add alternate fedi profile to user page

This commit is contained in:
Vincent Cloutier 2023-06-18 19:47:16 -04:00
parent 38aa9f2c62
commit 32ad3f7ba7
6 changed files with 15 additions and 3 deletions

View file

@ -39,8 +39,8 @@ foreach (string n in content.Split("\n"))
if (n.Length < 2) if (n.Length < 2)
continue; continue;
var acct = s[1]; var acct = s[1].ToLower();
var fedi = s[2]; var fedi = "@" + s[2];
await dal.UpdateTwitterUserFediAcctAsync(acct, fedi); await dal.UpdateTwitterUserFediAcctAsync(acct, fedi);
if (twitterUser.Contains(acct)) if (twitterUser.Contains(acct))
Console.WriteLine(fedi); Console.WriteLine(fedi);

View file

@ -141,7 +141,7 @@ namespace BirdsiteLive.Controllers
Protected = user.Protected, Protected = user.Protected,
FollowerCount = followers.Length, FollowerCount = followers.Length,
MostPopularServer = followers.GroupBy(x => x.Host).OrderByDescending(x => x.Count()).Select(x => x.Key).FirstOrDefault("N/A"), MostPopularServer = followers.GroupBy(x => x.Host).OrderByDescending(x => x.Count()).Select(x => x.Key).FirstOrDefault("N/A"),
FediverseAccount = userDal.FediAcct,
InstanceHandle = $"@{user.Acct.ToLowerInvariant()}@{_instanceSettings.Domain}" InstanceHandle = $"@{user.Acct.ToLowerInvariant()}@{_instanceSettings.Domain}"
}; };
return View(displayableUser); return View(displayableUser);

View file

@ -12,5 +12,6 @@
public string MostPopularServer { get; set; } public string MostPopularServer { get; set; }
public string InstanceHandle { get; set; } public string InstanceHandle { get; set; }
public string FediverseAccount { get; set; }
} }
} }

View file

@ -47,4 +47,13 @@
<input type="text" name="textbox" value="@ViewData.Model.InstanceHandle" onclick="this.select()" class="form-control" readonly /> <input type="text" name="textbox" value="@ViewData.Model.InstanceHandle" onclick="this.select()" class="form-control" readonly />
</div> </div>
} }
@if (ViewData.Model.FediverseAccount != null)
{
<br/>
<br/>
<div>
<p>There is a native fediverse account associated with this Twitter account:</p>
<input type="text" name="textbox" value="@ViewData.Model.FediverseAccount" onclick="this.select()" class="form-control" readonly />
</div>
}
</div> </div>

View file

@ -55,6 +55,7 @@ namespace BirdsiteLive.DAL.Postgres.DataAccessLayers
LastTweetPostedId = reader["lastTweetPostedId"] as long? ?? default, LastTweetPostedId = reader["lastTweetPostedId"] as long? ?? default,
LastSync = reader["lastSync"] as DateTime? ?? default, LastSync = reader["lastSync"] as DateTime? ?? default,
FetchingErrorCount = reader["fetchingErrorCount"] as int? ?? default, FetchingErrorCount = reader["fetchingErrorCount"] as int? ?? default,
FediAcct = reader["fediverseaccount"] as string,
}; };
} }

View file

@ -68,6 +68,7 @@ namespace BirdsiteLive.ActivityPub.Tests
} }
[TestMethod] [TestMethod]
[Ignore]
public async Task SimpleTextAndSingleVideoTweet() public async Task SimpleTextAndSingleVideoTweet()
{ {
var tweet = await _tweetService.GetTweetAsync(1604231025311129600); var tweet = await _tweetService.GetTweetAsync(1604231025311129600);