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

Fix e2e testcases #1917

Merged
merged 3 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion client/api/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ function update(original: IEventItem, updates: Partial<IEventItem>): Promise<Arr
return superdeskApi.dataApi.patch<IEventItem>('events', original, {
...updates,
associated_plannings: undefined,
embedded_planning: updates.associated_plannings.map((planning) => ({
embedded_planning: updates?.associated_plannings?.map((planning) => ({
planning_id: planning._id.startsWith(TEMP_ID_PREFIX) ? undefined : planning._id,
update_method: planning.update_method,
coverages: planning.coverages.map((coverage) => ({
Expand Down
7 changes: 5 additions & 2 deletions client/components/Main/CreateNewSubnavDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ class CreateNewSubnavDropdownFn extends React.PureComponent<IProps> {
const sortedTemplates = eventTemplates
.sort((templ1, templ2) => templ1.template_name.localeCompare(templ2.template_name));

recentTemplates
const templates = recentTemplates.length === 0 ? sortedTemplates : recentTemplates;

templates
.forEach((template) => {
items.push({
label: template.template_name,
Expand All @@ -74,7 +76,8 @@ class CreateNewSubnavDropdownFn extends React.PureComponent<IProps> {
});
});

if (sortedTemplates.length > MORE_TEMPLATES_THRESHOLD) {
if (recentTemplates.length < MORE_TEMPLATES_THRESHOLD ||
sortedTemplates.length > MORE_TEMPLATES_THRESHOLD) {
devketanpro marked this conversation as resolved.
Show resolved Hide resolved
items.push({
label: gettext('More templates...'),
icon: 'icon-event icon--blue',
Expand Down
Loading