Skip to content
Snippets Groups Projects
Commit 66c69f50 authored by Camille Blanchon's avatar Camille Blanchon
Browse files

Merge branch 'redmine-issues/17481' into 'develop'

REDMINE_ISSUE-17481 | Contributeur ne peut pas modifier son propre signalement

See merge request !589
parents 95451515 328c2362
No related branches found
No related tags found
1 merge request!589REDMINE_ISSUE-17481 | Contributeur ne peut pas modifier son propre signalement
......@@ -56,12 +56,19 @@ export default {
},
},
isFeatureCreator() {
if (this.currentFeature && this.currentFeature.properties && this.user) {
return this.currentFeature.properties.creator === this.user.id ||
this.currentFeature.properties.creator.username === this.user.username;
}
return false;
},
allowedStatusChoices() {
if (this.project && this.currentFeature && this.user) {
const isModerate = this.project.moderation;
const userStatus = this.USER_LEVEL_PROJECTS && this.USER_LEVEL_PROJECTS[this.project.slug];
const isOwnFeature = this.currentFeature.creator === this.user.id; //* si le contributeur est l'auteur du signalement
return allowedStatus2change(this.user, isModerate, userStatus, isOwnFeature, /* this.currentRouteName */);
return allowedStatus2change(this.user, isModerate, userStatus, this.isFeatureCreator);
}
return [];
},
......
......@@ -248,7 +248,7 @@ const feature = {
properties: {
title: state.form.title,
description: state.form.description.value,
status: state.form.status.value,
status: state.form.status.value.value || state.form.status.value,
project: rootState.projects.project.slug,
feature_type: rootState['feature-type'].current_feature_type_slug,
...extraFormObject
......
......@@ -511,15 +511,19 @@ export default {
},
},
isFeatureCreator() {
if (this.currentFeature && this.currentFeature.properties && this.user) {
return this.currentFeature.properties.creator === this.user.id ||
this.currentFeature.properties.creator.username === this.user.username;
}
return false;
},
allowedStatusChoices() {
if (this.project && this.user) {
const isModerate = this.project.moderation;
const userStatus = this.USER_LEVEL_PROJECTS[this.project.slug];
//* vérifier si le contributeur est l'auteur du signalement
const isOwnFeature = this.currentFeature && this.currentFeature.properties && //* check if feature exist already
this.currentFeature.properties.creator === this.user.id ||
this.currentFeature.properties.creator.username === this.user.username;
return allowedStatus2change(this.user, isModerate, userStatus, isOwnFeature, this.currentRouteName);
return allowedStatus2change(this.user, isModerate, userStatus, this.isFeatureCreator, this.currentRouteName);
}
return [];
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment