Skip to content

Commit

Permalink
Add a config option for top story sorting or default sorting (#976)
Browse files Browse the repository at this point in the history
  • Loading branch information
thecalcc authored Jun 26, 2024
1 parent fff21fd commit b190858
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions assets/agenda/components/AgendaList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {getIntVersion} from 'wire/utils';
import {getPlanningItemsByGroup, getListItems, isTopStory} from 'agenda/utils';
import {searchNavigationSelector} from 'search/selectors';
import {previewConfigSelector, listConfigSelector} from 'ui/selectors';
import {AGENDA_DATE_FORMAT_LONG, AGENDA_DATE_FORMAT_SHORT} from '../../utils';
import {AGENDA_DATE_FORMAT_LONG, AGENDA_DATE_FORMAT_SHORT, AGENDA_SORT_EVENTS_WITH_COVERAGE_ON_TOP} from '../../utils';


const PREVIEW_TIMEOUT = 500; // time to preview an item after selecting using kb
Expand Down Expand Up @@ -64,7 +64,7 @@ const getItemIdsSorted = (
} else {
restIds.push(item._id);
}
} else if (hasCoverage) {
} else if (hasCoverage && AGENDA_SORT_EVENTS_WITH_COVERAGE_ON_TOP == true) {

// items with coverages are displayed after top stories
coveragesOnlyIds.push(item._id);
Expand Down Expand Up @@ -520,4 +520,4 @@ function getLastGroupWithItems(groupedItems: Array<IAgendaListGroup>): number {

// If no groups have items, return the last group
return groupedItems.length - 1;
}
}
1 change: 1 addition & 0 deletions assets/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ interface IClientConfig {
button_label: string;
}
};
agenda_sort_events_with_coverage_on_top?: boolean;
show_user_register?: boolean;
multimedia_website_search_url?: string;
}
Expand Down
1 change: 1 addition & 0 deletions assets/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ export const SERVER_DATETIME_FORMAT = 'YYYY-MM-DDTHH:mm:ss+0000';
export const DAY_IN_MINUTES = 24 * 60 - 1;
export const LIST_ANIMATIONS = getConfig('list_animations', true);
export const DISPLAY_NEWS_ONLY = getConfig('display_news_only', true);
export const AGENDA_SORT_EVENTS_WITH_COVERAGE_ON_TOP = getConfig('agenda_sort_events_with_coverage_on_top', false);
export const DISPLAY_AGENDA_FEATURED_STORIES_ONLY = getConfig('display_agenda_featured_stories_only', true);
export const DISPLAY_ALL_VERSIONS_TOGGLE = getConfig('display_all_versions_toggle', true);
export const DEFAULT_TIMEZONE = getConfig('default_timezone', 'Australia/Sydney');
Expand Down
1 change: 1 addition & 0 deletions newsroom/web/default_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@
"button_label": lazy_gettext("Completed"),
},
},
"agenda_sort_events_with_coverage_on_top": False,
}

# Enable rendering of the date in the base view
Expand Down

0 comments on commit b190858

Please sign in to comment.