Skip to content

Commit

Permalink
fix(versioning): use version live from (#4118)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewelwell authored Jun 5, 2024
1 parent f0eae7b commit 0345aff
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions frontend/web/components/pages/ChangeRequestPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,17 @@ const ChangeRequestsPage = class extends Component {
AppActions.actionChangeRequest(this.props.match.params.id, 'approve')
}

getScheduledDate = (changeRequest) => {
return changeRequest.environment_feature_versions.length > 0
? moment(changeRequest.environment_feature_versions[0].live_from)
: moment(changeRequest.feature_states[0].live_from)
}

publishChangeRequest = () => {
const id = this.props.match.params.id
const changeRequest = ChangeRequestStore.model[id]
const isScheduled =
new Date(changeRequest.feature_states[0].live_from).valueOf() >
new Date().valueOf()
const scheduledDate = moment(changeRequest.feature_states[0].live_from)
const scheduledDate = this.getScheduledDate(changeRequest)
const isScheduled = scheduledDate > moment()

openConfirm({
body: (
Expand Down Expand Up @@ -252,11 +256,9 @@ const ChangeRequestsPage = class extends Component {
orgUsers &&
orgUsers.find((v) => v.id === changeRequest.committed_by)) ||
{}
const isScheduled =
new Date(changeRequest.feature_states[0].live_from).valueOf() >
new Date().valueOf()

const scheduledDate = moment(changeRequest.feature_states[0].live_from)
const scheduledDate = this.getScheduledDate(changeRequest)
const isScheduled = scheduledDate > moment()

const approval =
changeRequest &&
Expand Down

0 comments on commit 0345aff

Please sign in to comment.