Skip to content

Commit

Permalink
Merge branch 'develop' into async
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkLark86 committed Sep 24, 2024
2 parents a61d511 + 705edf2 commit 6f95e50
Show file tree
Hide file tree
Showing 132 changed files with 9,633 additions and 17,441 deletions.
12 changes: 0 additions & 12 deletions .flowconfig

This file was deleted.

10 changes: 9 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
versioning-strategy: widen
schedule:
interval: "weekly"

- package-ecosystem: "npm" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
ignore:
- dependency-name: "webpack"
versions: [">=5.0.0"]
- dependency-name: "webpack-dev-server"
versions: [">=5.0.0"]
- dependency-name: "css-loader"
versions: [">=6.0.0"]
- dependency-name: "style-loader"
versions: [">=2.0.0"]
19 changes: 18 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
## Checklist
### Purpose
<!--- Explain what this PR accomplishes. Why are we changing this? -->

### What has changed
<!--- Explain what has changed and how -->

### Steps to test
<!---
Try to explain in a few steps how to test and what things to look out for.
-->

<!-- [For UI changes]
### Screenshots
-->

### Checklist
<!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
- [ ] This pull request is not adding new forms that use redux
- [ ] This pull request is adding missing TypeScript types to modified code segments where it's easy to do so with confidence
- [ ] This pull request is replacing `lodash.get` with optional chaining for modified code segments

Resolves: #[issue-number]
12 changes: 7 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ jobs:
sudo apt-get update
sudo apt-get install pkg-config libxml2-dev libxmlsec1-dev libxmlsec1-openssl
- name: pip install
run: |
python -m pip install -U pip wheel setuptools
python -m pip install -Ur dev-requirements.txt
- run: python -m pip install --upgrade pip wheel setuptools
- run: python -m pip install -r dev-requirements.txt

- name: pytest
run: pytest --ignore=tests/aap/ --disable-pytest-warnings --cov=newsroom
Expand All @@ -47,12 +45,16 @@ jobs:
client:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: ['14', '18', '20']

steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 14.x
node-version: ${{ matrix.node-version }}
cache: npm

- name: npm install
Expand Down
3 changes: 0 additions & 3 deletions .jscsrc

This file was deleted.

57 changes: 0 additions & 57 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion assets/agenda/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ function setListGroupsAndLoadHiddenItems(items: Array<IAgendaItem>, next?: boole
}
}

const groups: Array<IAgendaListGroup> = (searchParams.sortQuery ?? '_score') === '_score' ?
const groups: Array<IAgendaListGroup> = (searchParams.sortQuery ?? '') === '' ?
groupItems(items, minDate, maxDate, activeGrouping, featuredOnly) :
[{
date: '',
Expand Down
14 changes: 10 additions & 4 deletions assets/agenda/components/AgendaApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {connect} from 'react-redux';
import {get, isEmpty} from 'lodash';

import {ISearchSortValue} from 'interfaces';
import {getItemFromArray, gettext} from 'utils';
import {noNavigationSelected} from 'search/utils';
import {gettext} from 'utils';
import {noNavigationSelected, searchParamsUpdated} from 'search/utils';

import {
fetchItems,
Expand Down Expand Up @@ -137,7 +137,7 @@ class AgendaApp extends SearchBase<any> {
showTotalItems = showTotalLabel = true;
}

const showFilters = Object.values(this.props.searchParams ?? {}).find((val) => val != null) != null ||
const showFilters = searchParamsUpdated(this.props.searchParams) ||
this.props.activeTopic != null ||
Object.keys(this.props.activeFilter ?? {}).length > 0 ||
this.props.activeQuery != null ||
Expand Down Expand Up @@ -252,7 +252,12 @@ class AgendaApp extends SearchBase<any> {
setQuery={this.props.setQuery}
setSortQuery={this.props.setSortQuery}
showSortDropdown={true}
defaultSortValue="_score"
sortOptions={[
{label: gettext('Date'), value: ''},
{label: gettext('Newest updates'), value: 'versioncreated:desc'},
{label: gettext('Oldest updates'), value: 'versioncreated:asc'},
{label: gettext('Relevance'), value: '_score'},
]}
/>
)
}
Expand Down Expand Up @@ -428,6 +433,7 @@ const mapDispatchToProps = (dispatch: any) => ({
toggleFeaturedFilter: (fetch: any) => dispatch(toggleFeaturedFilter(fetch)),
setQuery: (query: any) => dispatch(setQuery(query)),
setSortQuery: (query: ISearchSortValue) => dispatch(setSortQuery(query)),
saveMyTopic: (params: any) => dispatch(saveMyTopic(params)),
});

const component: React.ComponentType<any> = connect(mapStateToProps, mapDispatchToProps)(AgendaApp);
Expand Down
12 changes: 8 additions & 4 deletions assets/agenda/components/AgendaList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -352,17 +352,21 @@ class AgendaList extends React.Component<IProps, IState> {
const plans = this.props.itemTypeFilter !== 'planning' ?
[] :
getPlanningItemsByGroup(this.props.itemsById[itemId], group.date);
const version = getIntVersion(this.props.itemsById[itemId]);
const isRead = version == null
? this.props.readItems[itemId] != null // event
: version === this.props.readItems[itemId]; // planning item

return plans.length > 0 ? (
<React.Fragment key={`${itemId}--${group.date}`}>
{plans.map((plan) => (
<AgendaListItem
key={`${itemId}--${plan._id}`}
group={group.date}
group={group}
item={cloneDeep(this.props.itemsById[itemId])}
isActive={this.isActiveItem(itemId, group.date, plan)}
isSelected={this.props.selectedItems.includes(itemId)}
isRead={this.props.readItems[itemId] === getIntVersion(this.props.itemsById[itemId])}
isRead={isRead}
onClick={this.onItemClick}
onDoubleClick={this.onItemDoubleClick}
onActionList={this.onActionList}
Expand All @@ -386,11 +390,11 @@ class AgendaList extends React.Component<IProps, IState> {
) : (
<AgendaListItem
key={itemId}
group={group.date}
group={group}
item={this.props.itemsById[itemId]}
isActive={this.isActiveItem(itemId, group.date, undefined)}
isSelected={this.props.selectedItems.includes(itemId)}
isRead={this.props.readItems[itemId] === getIntVersion(this.props.itemsById[itemId])}
isRead={isRead}
onClick={this.onItemClick}
onDoubleClick={this.onItemDoubleClick}
onActionList={this.onActionList}
Expand Down
6 changes: 0 additions & 6 deletions assets/agenda/components/AgendaListGroupHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,11 @@ export function AgendaListGroupHeader({group, itemIds, itemsById, itemsShown, to
{coverageTypes.length === 0 ? (
<div className="list-group-header__title">
{gettext('More hidden')}
<span className="list-group-header__title-info">
({gettext('{{ numberOfItems }} Event', {numberOfItems: itemIds.length})})
</span>
</div>
) : (
<React.Fragment>
<div className="list-group-header__title">
{gettext('More hidden')}
<span className="list-group-header__title-info">
({gettext('{{ numberOfItems }} Event & Planning', {numberOfItems: itemCount})})
</span>
</div>
<div className="list-group-header__coverage-group">
{coverageTypes.map((coverageType) => (
Expand Down
34 changes: 21 additions & 13 deletions assets/agenda/components/AgendaListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import classNames from 'classnames';

import {IAgendaItem, IItemAction, IListConfig, IUser} from 'interfaces';
import {IAgendaItem, IAgendaListGroup, IItemAction, IListConfig, IUser} from 'interfaces';

import ActionButton from 'components/ActionButton';
import AgendaListItemIcons from './AgendaListItemIcons';
Expand All @@ -27,7 +27,7 @@ import {LabelGroup} from 'ui/components/LabelGroup';

interface IProps {
item: IAgendaItem;
group: string;
group: IAgendaListGroup;
isActive: boolean;
isSelected: boolean;
isRead: boolean;
Expand All @@ -40,9 +40,9 @@ interface IProps {
showShortcutActionIcons: boolean;
listConfig: IListConfig;

onClick(item: IAgendaItem, group: string, planningId?: IAgendaItem['_id']): void;
onDoubleClick(item: IAgendaItem, group: string, planningId?: IAgendaItem['_id']): void;
onActionList(event: React.MouseEvent, item: IAgendaItem, group: string, plan?: IAgendaItem): void;
onClick(item: IAgendaItem, date: string, planningId?: IAgendaItem['_id']): void;
onDoubleClick(item: IAgendaItem, date: string, planningId?: IAgendaItem['_id']): void;
onActionList(event: React.MouseEvent, item: IAgendaItem, date: string, plan?: IAgendaItem): void;
toggleSelected(): void;
resetActioningItem(): void;
}
Expand Down Expand Up @@ -83,11 +83,11 @@ class AgendaListItem extends React.Component<IProps> {
}

onArticleClick() {
this.props.onClick(this.props.item, this.props.group, this.props.planningId);
this.props.onClick(this.props.item, this.props.group.date, this.props.planningId);
}

onArticleDoubleClick() {
this.props.onDoubleClick(this.props.item, this.props.group, this.props.planningId);
this.props.onDoubleClick(this.props.item, this.props.group.date, this.props.planningId);
}

onMouseEnter() {
Expand Down Expand Up @@ -209,9 +209,9 @@ class AgendaListItem extends React.Component<IProps> {
if (segmentsRemainingToBeAdded > 0) {
paragraphsInnerText += paragraph.innerText;
paragraph.innerHTML = paragraph.innerHTML.split('<br>').filter((p: string) => p.trim() !== '').slice(0, segmentsRemainingToBeAdded).join('<br>');

segmentsRemainingToBeAdded = segmentsRemainingToBeAdded - getSegmentCount(paragraph);

descriptionHTMLArr.push(paragraph);
}
});
Expand Down Expand Up @@ -293,6 +293,14 @@ class AgendaListItem extends React.Component<IProps> {
}
})();

const renderTopStoryLabel = () => {
if (group.hiddenItems.includes(item._id) === false) {
return <TopStoryLabel item={item} config={listConfig} />;
} else {
return null;
}
};

return (
<article key={item._id}
className={classes.card}
Expand All @@ -305,7 +313,7 @@ class AgendaListItem extends React.Component<IProps> {
<div className={classes.wrap} tabIndex={0}>
<div className={classes.article} key="article">
<LabelGroup>
<TopStoryLabel item={item} config={listConfig} />
{renderTopStoryLabel()}
<ToBeConfirmedLabel item={item} />
</LabelGroup>

Expand Down Expand Up @@ -338,7 +346,7 @@ class AgendaListItem extends React.Component<IProps> {

<AgendaListItemIcons
item={item}
group={group}
group={group.date}
planningItem={planningItem}
isMobilePhone={isMobile}
user={this.props.user}
Expand Down Expand Up @@ -367,7 +375,7 @@ class AgendaListItem extends React.Component<IProps> {
item={this.props.item}
plan={planningItem}
user={this.props.user}
group={this.props.group}
group={this.props.group.date}
actions={this.props.actions}
onActionList={this.props.onActionList}
showActions={this.props.showActions}
Expand Down Expand Up @@ -418,7 +426,7 @@ class AgendaListItem extends React.Component<IProps> {
item={this.props.item}
plan={planningItem}
user={this.props.user}
group={this.props.group}
group={this.props.group.date}
actions={this.props.actions}
onActionList={this.props.onActionList}
showActions={this.props.showActions}
Expand Down
2 changes: 1 addition & 1 deletion assets/agenda/components/AgendaMetaTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function AgendaMetaTime({item, borderRight, isRecurring, group, i
{'m-0': onlyDates})}
>
{format(item, onlyDates === true)}
{itemDays <= 1 ? null : (
{itemDays <= 1 || group === '' ? null : (
<MultiDayListLabel
current={diffDays}
days={itemDays}
Expand Down
Loading

0 comments on commit 6f95e50

Please sign in to comment.