diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 21:42:06 +0300 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /app/assets/javascripts/releases/stores/modules/detail/getters.js | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'app/assets/javascripts/releases/stores/modules/detail/getters.js')
-rw-r--r-- | app/assets/javascripts/releases/stores/modules/detail/getters.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/app/assets/javascripts/releases/stores/modules/detail/getters.js b/app/assets/javascripts/releases/stores/modules/detail/getters.js index 84dc2fca4be..809ed075c16 100644 --- a/app/assets/javascripts/releases/stores/modules/detail/getters.js +++ b/app/assets/javascripts/releases/stores/modules/detail/getters.js @@ -2,6 +2,14 @@ import { isEmpty } from 'lodash'; import { hasContent } from '~/lib/utils/text_utility'; /** + * @returns {Boolean} `true` if the app is editing an existing release. + * `false` if the app is creating a new release. + */ +export const isExistingRelease = state => { + return Boolean(state.tagName); +}; + +/** * @param {Object} link The link to test * @returns {Boolean} `true` if the release link is empty, i.e. it has * empty (or whitespace-only) values for both `url` and `name`. @@ -39,6 +47,10 @@ export const validationErrors = state => { return errors; } + if (!state.release.tagName?.trim?.().length) { + errors.isTagNameEmpty = true; + } + // Each key of this object is a URL, and the value is an // array of Release link objects that share this URL. // This is used for detecting duplicate URLs. @@ -88,5 +100,6 @@ export const validationErrors = state => { /** Returns whether or not the release object is valid */ export const isValid = (_state, getters) => { - return Object.values(getters.validationErrors.assets.links).every(isEmpty); + const errors = getters.validationErrors; + return Object.values(errors.assets.links).every(isEmpty) && !errors.isTagNameEmpty; }; |