diff --git a/src/BirdsiteLive.Common/Regexes/UserRegexes.cs b/src/BirdsiteLive.Common/Regexes/UserRegexes.cs
index fc4783c..9a0569e 100644
--- a/src/BirdsiteLive.Common/Regexes/UserRegexes.cs
+++ b/src/BirdsiteLive.Common/Regexes/UserRegexes.cs
@@ -5,6 +5,6 @@ namespace BirdsiteLive.Common.Regexes
public class UserRegexes
{
public static readonly Regex TwitterAccount = new Regex(@"^[a-zA-Z0-9_]+$");
- public static readonly Regex Mention = new Regex(@"(.?)@([a-zA-Z0-9_]+)(\s|$|[\[\]<>,;:'\.’!?/|-]|(. ))");
+ public static readonly Regex Mention = new Regex(@"(.?)@([a-zA-Z0-9_]+)(\s|$|[\[\]<>,;:'\.’!?/—\|-]|(. ))");
}
}
\ No newline at end of file
diff --git a/src/BirdsiteLive.Domain/Tools/StatusExtractor.cs b/src/BirdsiteLive.Domain/Tools/StatusExtractor.cs
index 9d618d6..0761265 100644
--- a/src/BirdsiteLive.Domain/Tools/StatusExtractor.cs
+++ b/src/BirdsiteLive.Domain/Tools/StatusExtractor.cs
@@ -108,7 +108,7 @@ namespace BirdsiteLive.Domain.Tools
}
var url = $"https://{_instanceSettings.Domain}/users/{mention.ToLower()}";
- var name = $"@{mention}";
+ var name = $"@{mention.ToLower()}";
if (tags.All(x => x.href != url))
{
@@ -121,7 +121,7 @@ namespace BirdsiteLive.Domain.Tools
}
messageContent = Regex.Replace(messageContent, Regex.Escape(m.Groups[0].ToString()),
- $@"{m.Groups[1]}@{mention}{m.Groups[3]}");
+ $@"{m.Groups[1]}@{mention.ToLower()}{m.Groups[3]}");
}
}
diff --git a/src/BirdsiteLive.Twitter/Tools/TwitterAuthenticationInitializer.cs b/src/BirdsiteLive.Twitter/Tools/TwitterAuthenticationInitializer.cs
index 0a8e163..1fcb07b 100644
--- a/src/BirdsiteLive.Twitter/Tools/TwitterAuthenticationInitializer.cs
+++ b/src/BirdsiteLive.Twitter/Tools/TwitterAuthenticationInitializer.cs
@@ -35,7 +35,7 @@ namespace BirdsiteLive.Twitter.Tools
_logger = logger;
aTimer = new System.Timers.Timer();
- aTimer.Interval = 45 * 1000;
+ aTimer.Interval = 20 * 1000;
aTimer.Elapsed += async (sender, e) => await RefreshCred();
aTimer.Start();
diff --git a/src/Tests/BirdsiteLive.Domain.Tests/Tools/StatusExtractorTests.cs b/src/Tests/BirdsiteLive.Domain.Tests/Tools/StatusExtractorTests.cs
index 98be1c3..0460727 100644
--- a/src/Tests/BirdsiteLive.Domain.Tests/Tools/StatusExtractorTests.cs
+++ b/src/Tests/BirdsiteLive.Domain.Tests/Tools/StatusExtractorTests.cs
@@ -390,7 +390,7 @@ namespace BirdsiteLive.Domain.Tests.Tools
public void Extract_TagsWithPunctuations_Test()
{
#region Stubs
- var message = $"this: @amberfloio. @StellantisNA’s";
+ var message = $"this: @amberfloio. @VP—and @StellantisNA’s";
#endregion
#region Mocks
@@ -402,13 +402,18 @@ namespace BirdsiteLive.Domain.Tests.Tools
#region Validations
logger.VerifyAll();
- Assert.AreEqual(2, result.tags.Length);
+ Assert.AreEqual(3, result.tags.Length);
- Assert.AreEqual("@amberfloio", result.tags.First().name);
- Assert.AreEqual("Mention", result.tags.First().type);
- Assert.AreEqual("https://domain.name/users/amberfloio", result.tags.First().href);
+ Assert.AreEqual("@vp", result.tags[0].name);
+ Assert.AreEqual("Mention", result.tags[0].type);
+ Assert.AreEqual("https://domain.name/users/vp", result.tags[0].href);
- Assert.AreEqual("@StellantisNA", result.tags.Last().name);
+ Assert.AreEqual("@amberfloio", result.tags[1].name);
+ Assert.AreEqual("Mention", result.tags[1].type);
+ Assert.AreEqual("https://domain.name/users/amberfloio", result.tags[1].href);
+
+
+ Assert.AreEqual("@stellantisna", result.tags.Last().name);
Assert.AreEqual("Mention", result.tags.Last().type);
Assert.AreEqual("https://domain.name/users/stellantisna", result.tags.Last().href);
@@ -437,8 +442,8 @@ namespace BirdsiteLive.Domain.Tests.Tools
Assert.AreEqual("Mention", result.tags.First().type);
Assert.IsTrue(result.content.Contains(@"@photos_floues"));
- Assert.IsTrue(result.content.Contains(@"@KiwixOffline @photos_floues"));
- Assert.IsTrue(result.content.Contains(@"Cc @Pyb75 @photos_floues @KiwixOffline"));
+ Assert.IsTrue(result.content.Contains(@"@kiwixoffline @photos_floues"));
+ Assert.IsTrue(result.content.Contains(@"Cc @pyb75 @photos_floues @kiwixoffline"));
#endregion
}
@@ -564,12 +569,12 @@ namespace BirdsiteLive.Domain.Tests.Tools
#region Validations
logger.VerifyAll();
Assert.AreEqual(1, result.tags.Length);
- Assert.AreEqual("@myNickName", result.tags.First().name);
+ Assert.AreEqual("@mynickname", result.tags.First().name);
Assert.AreEqual("Mention", result.tags.First().type);
Assert.AreEqual("https://domain.name/users/mynickname", result.tags.First().href);
Assert.IsTrue(result.content.Contains("Bla!"));
- Assert.IsTrue(result.content.Contains(@"@myNickName"));
+ Assert.IsTrue(result.content.Contains(@"@mynickname"));
#endregion
}
diff --git a/src/Tests/BirdsiteLive.Twitter.Tests/TimelineTests.cs b/src/Tests/BirdsiteLive.Twitter.Tests/TimelineTests.cs
index 0aadd77..8f28c0d 100644
--- a/src/Tests/BirdsiteLive.Twitter.Tests/TimelineTests.cs
+++ b/src/Tests/BirdsiteLive.Twitter.Tests/TimelineTests.cs
@@ -49,7 +49,7 @@ namespace BirdsiteLive.ActivityPub.Tests
{
var tweets = await _tweetService.GetTimelineAsync("grantimahara", default);
Assert.IsTrue(tweets[0].IsReply);
- Assert.AreEqual(tweets.Length, 40);
+ Assert.IsTrue(tweets.Length > 30);
}
}