diff options
-rw-r--r-- | app/assets/javascripts/notes/stores/actions.js | 15 | ||||
-rw-r--r-- | app/assets/javascripts/notes/stores/getters.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/notes/stores/modules/index.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/notes/stores/mutations.js | 8 | ||||
-rw-r--r-- | app/assets/javascripts/vue_shared/components/notes/system_note.vue | 5 | ||||
-rw-r--r-- | app/services/pod_logs/elasticsearch_service.rb | 2 | ||||
-rw-r--r-- | app/services/pod_logs/kubernetes_service.rb | 2 | ||||
-rw-r--r-- | doc/.linting/vale/styles/gitlab/RelativeLinks.yml | 5 | ||||
-rw-r--r-- | doc/administration/geo/disaster_recovery/index.md | 2 | ||||
-rw-r--r-- | doc/administration/geo/replication/troubleshooting.md | 2 | ||||
-rwxr-xr-x | scripts/lint-doc.sh | 2 | ||||
-rw-r--r-- | spec/frontend/notes/stores/getters_spec.js | 8 | ||||
-rw-r--r-- | spec/frontend/notes/stores/mutation_spec.js | 24 |
13 files changed, 54 insertions, 25 deletions
diff --git a/app/assets/javascripts/notes/stores/actions.js b/app/assets/javascripts/notes/stores/actions.js index a4b9c64645c..2e6719bb4fb 100644 --- a/app/assets/javascripts/notes/stores/actions.js +++ b/app/assets/javascripts/notes/stores/actions.js @@ -515,7 +515,7 @@ export const removeConvertedDiscussion = ({ commit }, noteId) => export const setCurrentDiscussionId = ({ commit }, discussionId) => commit(types.SET_CURRENT_DISCUSSION_ID, discussionId); -export const fetchDescriptionVersion = ({ dispatch }, { endpoint, startingVersion }) => { +export const fetchDescriptionVersion = ({ dispatch }, { endpoint, startingVersion, versionId }) => { let requestUrl = endpoint; if (startingVersion) { @@ -526,7 +526,7 @@ export const fetchDescriptionVersion = ({ dispatch }, { endpoint, startingVersio return axios .get(requestUrl) .then(res => { - dispatch('receiveDescriptionVersion', res.data); + dispatch('receiveDescriptionVersion', { descriptionVersion: res.data, versionId }); }) .catch(error => { dispatch('receiveDescriptionVersionError', error); @@ -544,7 +544,10 @@ export const receiveDescriptionVersionError = ({ commit }, error) => { commit(types.RECEIVE_DESCRIPTION_VERSION_ERROR, error); }; -export const softDeleteDescriptionVersion = ({ dispatch }, { endpoint, startingVersion }) => { +export const softDeleteDescriptionVersion = ( + { dispatch }, + { endpoint, startingVersion, versionId }, +) => { let requestUrl = endpoint; if (startingVersion) { @@ -555,7 +558,7 @@ export const softDeleteDescriptionVersion = ({ dispatch }, { endpoint, startingV return axios .delete(requestUrl) .then(() => { - dispatch('receiveDeleteDescriptionVersion'); + dispatch('receiveDeleteDescriptionVersion', versionId); }) .catch(error => { dispatch('receiveDeleteDescriptionVersionError', error); @@ -566,8 +569,8 @@ export const softDeleteDescriptionVersion = ({ dispatch }, { endpoint, startingV export const requestDeleteDescriptionVersion = ({ commit }) => { commit(types.REQUEST_DELETE_DESCRIPTION_VERSION); }; -export const receiveDeleteDescriptionVersion = ({ commit }) => { - commit(types.RECEIVE_DELETE_DESCRIPTION_VERSION, __('Deleted')); +export const receiveDeleteDescriptionVersion = ({ commit }, versionId) => { + commit(types.RECEIVE_DELETE_DESCRIPTION_VERSION, { [versionId]: __('Deleted') }); }; export const receiveDeleteDescriptionVersionError = ({ commit }, error) => { commit(types.RECEIVE_DELETE_DESCRIPTION_VERSION_ERROR, error); diff --git a/app/assets/javascripts/notes/stores/getters.js b/app/assets/javascripts/notes/stores/getters.js index 3a1e795cff4..28cc9cdd7e9 100644 --- a/app/assets/javascripts/notes/stores/getters.js +++ b/app/assets/javascripts/notes/stores/getters.js @@ -28,7 +28,7 @@ export const getUserData = state => state.userData || {}; export const getUserDataByProp = state => prop => state.userData && state.userData[prop]; -export const descriptionVersion = state => state.descriptionVersion; +export const descriptionVersions = state => state.descriptionVersions; export const notesById = state => state.discussions.reduce((acc, note) => { diff --git a/app/assets/javascripts/notes/stores/modules/index.js b/app/assets/javascripts/notes/stores/modules/index.js index 0e991f2f4f0..2d317dcd7da 100644 --- a/app/assets/javascripts/notes/stores/modules/index.js +++ b/app/assets/javascripts/notes/stores/modules/index.js @@ -28,7 +28,7 @@ export default () => ({ commentsDisabled: false, resolvableDiscussionsCount: 0, unresolvedDiscussionsCount: 0, - descriptionVersion: null, + descriptionVersions: {}, }, actions, getters, diff --git a/app/assets/javascripts/notes/stores/mutations.js b/app/assets/javascripts/notes/stores/mutations.js index d32a88e4c71..c23ef93c056 100644 --- a/app/assets/javascripts/notes/stores/mutations.js +++ b/app/assets/javascripts/notes/stores/mutations.js @@ -288,9 +288,9 @@ export default { [types.REQUEST_DESCRIPTION_VERSION](state) { state.isLoadingDescriptionVersion = true; }, - [types.RECEIVE_DESCRIPTION_VERSION](state, descriptionVersion) { - state.isLoadingDescriptionVersion = false; - state.descriptionVersion = descriptionVersion; + [types.RECEIVE_DESCRIPTION_VERSION](state, { descriptionVersion, versionId }) { + const descriptionVersions = { ...state.descriptionVersions, [versionId]: descriptionVersion }; + Object.assign(state, { descriptionVersions, isLoadingDescriptionVersion: false }); }, [types.RECEIVE_DESCRIPTION_VERSION_ERROR](state) { state.isLoadingDescriptionVersion = false; @@ -300,7 +300,7 @@ export default { }, [types.RECEIVE_DELETE_DESCRIPTION_VERSION](state, descriptionVersion) { state.isLoadingDescriptionVersion = false; - state.descriptionVersion = descriptionVersion; + Object.assign(state.descriptionVersions, descriptionVersion); }, [types.RECEIVE_DELETE_DESCRIPTION_VERSION_ERROR](state) { state.isLoadingDescriptionVersion = false; diff --git a/app/assets/javascripts/vue_shared/components/notes/system_note.vue b/app/assets/javascripts/vue_shared/components/notes/system_note.vue index 908f7196abf..4ad382ed888 100644 --- a/app/assets/javascripts/vue_shared/components/notes/system_note.vue +++ b/app/assets/javascripts/vue_shared/components/notes/system_note.vue @@ -54,7 +54,7 @@ export default { }; }, computed: { - ...mapGetters(['targetNoteHash', 'descriptionVersion']), + ...mapGetters(['targetNoteHash', 'descriptionVersions']), ...mapState(['isLoadingDescriptionVersion']), noteAnchorId() { return `note_${this.note.id}`; @@ -81,6 +81,9 @@ export default { .children().length > MAX_VISIBLE_COMMIT_LIST_COUNT ); }, + descriptionVersion() { + return this.descriptionVersions[this.note.description_version_id]; + }, }, mounted() { initMRPopovers(this.$el.querySelectorAll('.gfm-merge_request')); diff --git a/app/services/pod_logs/elasticsearch_service.rb b/app/services/pod_logs/elasticsearch_service.rb index 7524bf7ce10..cd56565ec61 100644 --- a/app/services/pod_logs/elasticsearch_service.rb +++ b/app/services/pod_logs/elasticsearch_service.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module PodLogs - class ElasticsearchService < BaseService + class ElasticsearchService < PodLogs::BaseService steps :check_arguments, :check_param_lengths, :get_raw_pods, diff --git a/app/services/pod_logs/kubernetes_service.rb b/app/services/pod_logs/kubernetes_service.rb index 8f12b364e73..6c8ed74f8e1 100644 --- a/app/services/pod_logs/kubernetes_service.rb +++ b/app/services/pod_logs/kubernetes_service.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module PodLogs - class KubernetesService < BaseService + class KubernetesService < PodLogs::BaseService LOGS_LIMIT = 500.freeze REPLACEMENT_CHAR = "\u{FFFD}" diff --git a/doc/.linting/vale/styles/gitlab/RelativeLinks.yml b/doc/.linting/vale/styles/gitlab/RelativeLinks.yml index fccd29b8a25..95bd60dd6e4 100644 --- a/doc/.linting/vale/styles/gitlab/RelativeLinks.yml +++ b/doc/.linting/vale/styles/gitlab/RelativeLinks.yml @@ -1,12 +1,11 @@ --- # Checks for the presence of absolute hyperlinks that should be relative. # -# Requires --ignore-syntax CLI flag to find matches. -# # For a list of all options, see https://errata-ai.github.io/vale/styles/ extends: existence -message: URL '%s' must be relative. +message: Link %s must be relative. link: https://docs.gitlab.com/ee/development/documentation/styleguide.html#links-to-internal-documentation level: error +scope: raw raw: - '\[.+\]\(https?:\/\/docs\.gitlab\.com\/ee.*\)' diff --git a/doc/administration/geo/disaster_recovery/index.md b/doc/administration/geo/disaster_recovery/index.md index 1a336f89615..7ecb4893c88 100644 --- a/doc/administration/geo/disaster_recovery/index.md +++ b/doc/administration/geo/disaster_recovery/index.md @@ -139,7 +139,7 @@ do this manually. sudo gitlab-pg-ctl promote ``` - In GitLab 12.8 and earlier, see [Message: "sudo: gitlab-pg-ctl: command not found"](../replication/troubleshooting.md#message-sudo-gitlab-pg-ctl-command-not-found). + In GitLab 12.8 and earlier, see [Message: `sudo: gitlab-pg-ctl: command not found`](../replication/troubleshooting.md#message-sudo-gitlab-pg-ctl-command-not-found). 1. Edit `/etc/gitlab/gitlab.rb` on every machine in the **secondary** to reflect its new status as **primary** by removing any lines that enabled the diff --git a/doc/administration/geo/replication/troubleshooting.md b/doc/administration/geo/replication/troubleshooting.md index 77d1cad071a..e075a2b132e 100644 --- a/doc/administration/geo/replication/troubleshooting.md +++ b/doc/administration/geo/replication/troubleshooting.md @@ -514,7 +514,7 @@ or `gitlab-ctl promote-to-primary-node`, either: bug](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/22021) was fixed. -### Message: "sudo: gitlab-pg-ctl: command not found" +### Message: `sudo: gitlab-pg-ctl: command not found` When [promoting a **secondary** node with HA](../disaster_recovery/index.md#promoting-a-secondary-node-with-ha), diff --git a/scripts/lint-doc.sh b/scripts/lint-doc.sh index 3959b8b510e..d9440a5f052 100755 --- a/scripts/lint-doc.sh +++ b/scripts/lint-doc.sh @@ -80,7 +80,7 @@ echo '=> Linting markdown style...' run_locally_or_in_docker 'markdownlint' "--config .markdownlint.json ${MD_DOC_PATH}" echo '=> Linting prose...' -run_locally_or_in_docker 'vale' "--minAlertLevel error --ignore-syntax ${MD_DOC_PATH}" +run_locally_or_in_docker 'vale' "--minAlertLevel error ${MD_DOC_PATH}" echo "✔ Linting passed" exit 0 diff --git a/spec/frontend/notes/stores/getters_spec.js b/spec/frontend/notes/stores/getters_spec.js index 1ade9464128..602e4c70741 100644 --- a/spec/frontend/notes/stores/getters_spec.js +++ b/spec/frontend/notes/stores/getters_spec.js @@ -35,7 +35,7 @@ describe('Getters Notes Store', () => { notesData: notesDataMock, userData: userDataMock, noteableData: noteableDataMock, - descriptionVersion: 'descriptionVersion', + descriptionVersions: 'descriptionVersions', }; }); @@ -387,9 +387,9 @@ describe('Getters Notes Store', () => { }); }); - describe('descriptionVersion', () => { - it('should return `descriptionVersion`', () => { - expect(getters.descriptionVersion(state)).toEqual('descriptionVersion'); + describe('descriptionVersions', () => { + it('should return `descriptionVersions`', () => { + expect(getters.descriptionVersions(state)).toEqual('descriptionVersions'); }); }); }); diff --git a/spec/frontend/notes/stores/mutation_spec.js b/spec/frontend/notes/stores/mutation_spec.js index 46b4081f6f6..ee772afbc03 100644 --- a/spec/frontend/notes/stores/mutation_spec.js +++ b/spec/frontend/notes/stores/mutation_spec.js @@ -8,6 +8,7 @@ import { userDataMock, noteableDataMock, individualNote, + notesWithDescriptionChanges, } from '../mock_data'; const RESOLVED_NOTE = { resolvable: true, resolved: true }; @@ -579,4 +580,27 @@ describe('Notes Store mutations', () => { expect(state.convertedDisscussionIds).not.toContain(discussion.id); }); }); + + describe('RECEIVE_DESCRIPTION_VERSION', () => { + const descriptionVersion = notesWithDescriptionChanges[0].notes[0].note; + const versionId = notesWithDescriptionChanges[0].notes[0].id; + const state = {}; + + it('adds a descriptionVersion', () => { + mutations.RECEIVE_DESCRIPTION_VERSION(state, { descriptionVersion, versionId }); + expect(state.descriptionVersions[versionId]).toBe(descriptionVersion); + }); + }); + + describe('RECEIVE_DELETE_DESCRIPTION_VERSION', () => { + const descriptionVersion = notesWithDescriptionChanges[0].notes[0].note; + const versionId = notesWithDescriptionChanges[0].notes[0].id; + const state = { descriptionVersions: { [versionId]: descriptionVersion } }; + const deleted = 'Deleted'; + + it('updates descriptionVersion to "Deleted"', () => { + mutations.RECEIVE_DELETE_DESCRIPTION_VERSION(state, { [versionId]: deleted }); + expect(state.descriptionVersions[versionId]).toBe(deleted); + }); + }); }); |