Merge pull request #3123 from NobodysNightmare/feature/display_date_without_edit_permission

fix error displaying dates without edit permission
pull/3029/merge
ulferts 10 years ago
commit 07586880bf
  1. 18
      frontend/app/work_packages/services/work-package-field-service.js

@ -92,13 +92,21 @@ module.exports = function(
} }
function isMilestone(workPackage) { function isMilestone(workPackage) {
var embedded = workPackage.form.embedded, // TODO: this should be written as "only use the form when editing"
// otherwise always use the simple way
// currently we don't know the context in which this method is called
var formAvailable = !_.isUndefined(workPackage.form);
if (formAvailable) {
var embedded = workPackage.form.embedded,
allowedValues = embedded.schema.props.type._embedded.allowedValues, allowedValues = embedded.schema.props.type._embedded.allowedValues,
currentType = embedded.payload.links.type.props.href; currentType = embedded.payload.links.type.props.href;
return _.some(allowedValues, function(allowedValue) { return _.some(allowedValues, function(allowedValue) {
return allowedValue._links.self.href === currentType && return allowedValue._links.self.href === currentType &&
allowedValue.isMilestone; allowedValue.isMilestone;
}); });
} else {
return workPackage.embedded.type.isMilestone;
}
} }
function getValue(workPackage, field) { function getValue(workPackage, field) {

Loading…
Cancel
Save