Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Search): limit All to 4 per category #709

Merged
merged 1 commit into from
Dec 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/Views/Search.vala
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,12 @@ public class Tuba.Views.Search : Views.TabbedBase {

void append_results (Gee.ArrayList<Entity> array, Views.ContentBase tab) {
if (!array.is_empty) {
int all_i = 0;
array.@foreach (e => {
append_entity (all_tab, e);
if (all_i < 4) {
append_entity (all_tab, e);
all_i++;
}
append_entity (tab, e);

return true;
Expand All @@ -82,10 +86,9 @@ public class Tuba.Views.Search : Views.TabbedBase {
bool hashtag = query.has_prefix ("#");

if (hashtag) append_results (results.hashtags, hashtags_tab);

append_results (results.accounts, accounts_tab);
append_results (results.statuses, statuses_tab);
if (!hashtag) append_results (results.hashtags, hashtags_tab);
append_results (results.statuses, statuses_tab);

base_status = new StatusMessage ();

Expand Down