Commit 3018cab4 authored by Matija Obreza's avatar Matija Obreza
Browse files

Merge branch '306-allow-unpublish-for-users' into 'master'

Resolve "Allow unpublish for users"

Closes #306

See merge request !243
parents bdb41116 c2ce8426
......@@ -4,6 +4,7 @@ import { translate } from 'react-i18next';
import { withStyles } from 'material-ui/styles';
import {log} from 'utilities/debug';
import { fixDate } from 'utilities';
import { Dataset } from 'model/dataset.model';
import { Descriptor } from 'model/descriptor.model';
......@@ -196,7 +197,7 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
const license = dataset.rights && AVAILABLE_LICENSES.find((e) => e.code === dataset.rights);
const oneDay = 24 * 60 * 60 * 1000;
const oneDayPassed = dataset && (dataset.lastModifiedDate.getTime() <= (new Date()).getTime() - oneDay);
const oneDayPassed = dataset && (fixDate(dataset.lastModifiedDate).getTime() <= (new Date()).getTime() - oneDay);
return (
<div className={ classes.root }>
......
......@@ -3,6 +3,7 @@ import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {log} from 'utilities/debug';
import { fixDate } from 'utilities';
import { loadDescriptor, publishDescriptor, deleteDescriptor } from 'actions/descriptors';
......@@ -104,7 +105,7 @@ class DisplayPage extends React.Component<IDisplayPageProps, any> {
const stillLoading: boolean = (! descriptor || (uuid && (descriptor.uuid !== uuid)));
const oneDay = 24 * 60 * 60 * 1000;
const oneDayPassed = descriptor && (descriptor.lastModifiedDate.getTime() <= (new Date()).getTime() - oneDay);
const oneDayPassed = descriptor && (fixDate(descriptor.lastModifiedDate).getTime() <= (new Date()).getTime() - oneDay);
// const terms: VocabularyTerm[] = descriptor ? (descriptor.terms || (descriptor.vocabulary ? descriptor.vocabulary.terms : null)) : null;
// <PropertiesItem title="Publisher:">{ descriptor.publisher || <i>Not specified</i> }</PropertiesItem>
......
......@@ -4,6 +4,7 @@ import {Descriptor, DescriptorList} from 'model/descriptor.model';
import confirm from 'utilities/confirmAlert';
import {log} from 'utilities/debug';
import { fixDate } from 'utilities';
import Authorize from 'ui/common/authorized/Authorize';
import Markdown from 'ui/catalog/markdown';
......@@ -153,7 +154,7 @@ class DetailInfo extends React.Component<IDetailInfoProps, any> {
const {classes, descriptorList, review} = this.props;
const oneDay = 24 * 60 * 60 * 1000;
const oneDayPassed = descriptorList && (descriptorList.lastModifiedDate.getTime() <= (new Date()).getTime() - oneDay);
const oneDayPassed = descriptorList && (fixDate(descriptorList.lastModifiedDate).getTime() <= (new Date()).getTime() - oneDay);
return (
<div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment