A handle finds its account, not posts and a made-up hashtag
Since status search by words, searching "@name@host" also answered posts sharing the handle's words and a hashtag "#@name@host" made of the query, so a client that opens the profile when the account is the only result (decePub's search) stayed on the list. A handle now searches accounts only, and a hashtag result is offered only when the query is one (letters, marks, digits and underscores, with a letter). Found by decePub's end-to-end tests: every profile follow test failed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
1 parent
17922f4dfd
commit
4a9a3d3235
3 files changed
+31
-3
No files matched your search
@@ -46,5 +46,23 @@ namespace PrivaPub.Tests.Http
|
||||
Assert.Equal(new[] { named },
|
||||
(await reader.Client.Get($"/api/v2/search?q={word}&type=statuses&limit=1&offset=1")).Ok().Body["statuses"]!.AsArray().Select(s => s.Text("id")));
|
||||
}
|
||||
|
||||
// a handle asks for its account: no posts sharing its words, and no hashtag made of it
|
||||
[Fact]
|
||||
public async Task A_handle_finds_its_account_and_neither_posts_nor_a_hashtag()
|
||||
{
|
||||
var reader = await _host.Mastodon("reader");
|
||||
var named = await _host.Mastodon("named");
|
||||
await reader.Status($"talking of {named.UserName} here");
|
||||
|
||||
foreach (var q in new[] { $"@{named.UserName}", $"@{named.UserName}@{PrivaPubHost.Host}", $"{named.UserName}@{PrivaPubHost.Host}" })
|
||||
{
|
||||
var body = (await reader.Client.Get($"/api/v2/search?q={Uri.EscapeDataString(q)}")).Ok().Body;
|
||||
Assert.Contains(body["accounts"]!.AsArray(), a => a.Text("id") == named.Id);
|
||||
Assert.Empty(body["statuses"]!.AsArray());
|
||||
Assert.Empty(body["hashtags"]!.AsArray());
|
||||
}
|
||||
Assert.Equal("cats", Assert.Single((await reader.Client.Get("/api/v2/search?q=%23Cats")).Ok().Body["hashtags"]!.AsArray()).Text("name"));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user