From 7425658fb7af50a0aabe373c2099dd7eda458cbd Mon Sep 17 00:00:00 2001 From: Frank Niessink Date: Wed, 29 Jan 2025 19:56:29 +0100 Subject: [PATCH] The comment field of a metric's technical debt tab would be editable even though the user was not logged in or when the user was time traveling. Note that the server would not save any changes made as it also checks for correct permissions. Fixes #10739. --- components/frontend/src/fields/CommentField.js | 2 +- components/frontend/src/fields/MultipleChoiceField.js | 2 +- components/frontend/src/fields/TextField.js | 2 +- components/frontend/src/metric/MetricDebtParameters.js | 3 +++ docs/src/changelog.md | 1 + 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/components/frontend/src/fields/CommentField.js b/components/frontend/src/fields/CommentField.js index a1d7ebf620..211d371c10 100644 --- a/components/frontend/src/fields/CommentField.js +++ b/components/frontend/src/fields/CommentField.js @@ -16,7 +16,7 @@ export function CommentField({ disabled, id, onChange, value }) { ) } CommentField.propTypes = { - disabled: bool, + disabled: bool.isRequired, id: string, onChange: func, value: string, diff --git a/components/frontend/src/fields/MultipleChoiceField.js b/components/frontend/src/fields/MultipleChoiceField.js index 56420f9007..ef74163538 100644 --- a/components/frontend/src/fields/MultipleChoiceField.js +++ b/components/frontend/src/fields/MultipleChoiceField.js @@ -52,7 +52,7 @@ export function MultipleChoiceField({ ) } MultipleChoiceField.propTypes = { - disabled: bool, + disabled: bool.isRequired, freeSolo: bool, helperText: string, label: string, diff --git a/components/frontend/src/fields/TextField.js b/components/frontend/src/fields/TextField.js index 57b89515e5..fb9dbace2c 100644 --- a/components/frontend/src/fields/TextField.js +++ b/components/frontend/src/fields/TextField.js @@ -80,7 +80,7 @@ export function TextField({ } TextField.propTypes = { children: childrenPropType, - disabled: bool, + disabled: bool.isRequired, endAdornment: oneOfType([element, string]), error: bool, helperText: oneOfType([element, string]), diff --git a/components/frontend/src/metric/MetricDebtParameters.js b/components/frontend/src/metric/MetricDebtParameters.js index e5d448f18b..a43eedf22c 100644 --- a/components/frontend/src/metric/MetricDebtParameters.js +++ b/components/frontend/src/metric/MetricDebtParameters.js @@ -88,6 +88,8 @@ TechnicalDebtEndDate.propTypes = { } export function MetricDebtParameters({ metric, metric_uuid, reload, report }) { + const permissions = useContext(Permissions) + const disabled = !accessGranted(permissions, [EDIT_REPORT_PERMISSION]) return ( @@ -108,6 +110,7 @@ export function MetricDebtParameters({ metric, metric_uuid, reload, report }) { set_metric_attribute(metric_uuid, "comment", value, reload)} value={metric.comment} /> diff --git a/docs/src/changelog.md b/docs/src/changelog.md index ede08b127e..c4abe9b35e 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -22,6 +22,7 @@ If your currently installed *Quality-time* version is not the latest version, pl - Fix accessibility issues found by the application test. Fixes [#6354](https://github.com/ICTU/quality-time/issues/6354). - When adding multiple sources to one metric, the source names would not be comma-separated in the sources column. Fixes [#10735](https://github.com/ICTU/quality-time/issues/10735). +- The comment field of a metric's technical debt tab would be editable even though the user was not logged in or when the user was time traveling. Note that the server would not save any changes made as it also checks for correct permissions. Fixes [#10739](https://github.com/ICTU/quality-time/issues/10739). ### Changed