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-7016: Link redirect of current day results in user forward to wrong filtered page #9145

Merged
merged 2 commits into from Aug 21, 2023
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
4 changes: 2 additions & 2 deletions app/routes/public/cfs/edit-speaker.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default class EditSpeakerRoute extends Route {

async model(params) {
const eventDetails = this.modelFor('public');
const speaker = await this.store.findRecord('speaker', params.speaker_id, { include: 'sessions' })
const speaker = await this.store.findRecord('speaker', params.speaker_id, { include: 'sessions' });
return {
event : eventDetails,
forms : await eventDetails.query('customForms', {
Expand All @@ -24,4 +24,4 @@ export default class EditSpeakerRoute extends Route {
speaker
};
}
}
}
9 changes: 4 additions & 5 deletions app/routes/public/sessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import classic from 'ember-classic-decorator';
import Route from '@ember/routing/route';
import moment from 'moment-timezone';

let isDateFilterActive = Boolean(new URLSearchParams(location.search).get('date'));

@classic
export default class SessionsRoute extends Route {
queryParams = {
Expand Down Expand Up @@ -46,9 +44,10 @@ export default class SessionsRoute extends Route {
async beforeModel() {
const event = this.modelFor('public');
const dates = await this.loader.load('/events/' + event.id + '/sessions/dates');
if (moment().isSameOrAfter(event.startsAt) && moment().isSameOrBefore(event.endsAt) && dates.includes(moment().format('YYYY-MM-DD')) && !isDateFilterActive) {
isDateFilterActive = true;
this.transitionTo('public.sessions', event.get('identifier'), { queryParams: { date: moment().format('YYYY-MM-DD') } });
if (new URLSearchParams(location.search).size === 0) {
if (moment().isSameOrAfter(event.startsAt) && moment().isSameOrBefore(event.endsAt) && dates.includes(moment().format('YYYY-MM-DD'))) {
this.transitionTo('public.sessions', event.get('identifier'), { queryParams: { date: moment().format('YYYY-MM-DD') } });
}
}
}

Expand Down
Loading