Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-20 18:08:57 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-20 18:08:57 +0300
commit6b5e293c6d5c678e78f2a0933d636a33e4723061 (patch)
treeb83c7bff3e2329e439fbc6db948f5e14e8b77ac9 /app/assets/javascripts/vuex_shared
parentbe2142bf5e03af8ba9bb96e4bf0b4781184ae01b (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/vuex_shared')
-rw-r--r--app/assets/javascripts/vuex_shared/modules/members/actions.js19
-rw-r--r--app/assets/javascripts/vuex_shared/modules/members/mutation_types.js3
-rw-r--r--app/assets/javascripts/vuex_shared/modules/members/mutations.js15
3 files changed, 37 insertions, 0 deletions
diff --git a/app/assets/javascripts/vuex_shared/modules/members/actions.js b/app/assets/javascripts/vuex_shared/modules/members/actions.js
index f7fdddfd070..4c31b3c9744 100644
--- a/app/assets/javascripts/vuex_shared/modules/members/actions.js
+++ b/app/assets/javascripts/vuex_shared/modules/members/actions.js
@@ -1,5 +1,6 @@
import * as types from './mutation_types';
import axios from '~/lib/utils/axios_utils';
+import { formatDate } from '~/lib/utils/datetime_utility';
export const updateMemberRole = async ({ state, commit }, { memberId, accessLevel }) => {
try {
@@ -23,3 +24,21 @@ export const showRemoveGroupLinkModal = ({ commit }, groupLink) => {
export const hideRemoveGroupLinkModal = ({ commit }) => {
commit(types.HIDE_REMOVE_GROUP_LINK_MODAL);
};
+
+export const updateMemberExpiration = async ({ state, commit }, { memberId, expiresAt }) => {
+ try {
+ await axios.put(
+ state.memberPath.replace(':id', memberId),
+ state.requestFormatter({ expires_at: expiresAt ? formatDate(expiresAt, 'isoDate') : '' }),
+ );
+
+ commit(types.RECEIVE_MEMBER_EXPIRATION_SUCCESS, {
+ memberId,
+ expiresAt: expiresAt ? formatDate(expiresAt, 'isoUtcDateTime') : null,
+ });
+ } catch (error) {
+ commit(types.RECEIVE_MEMBER_EXPIRATION_ERROR);
+
+ throw error;
+ }
+};
diff --git a/app/assets/javascripts/vuex_shared/modules/members/mutation_types.js b/app/assets/javascripts/vuex_shared/modules/members/mutation_types.js
index 00f4c910669..77307aa745b 100644
--- a/app/assets/javascripts/vuex_shared/modules/members/mutation_types.js
+++ b/app/assets/javascripts/vuex_shared/modules/members/mutation_types.js
@@ -1,6 +1,9 @@
export const RECEIVE_MEMBER_ROLE_SUCCESS = 'RECEIVE_MEMBER_ROLE_SUCCESS';
export const RECEIVE_MEMBER_ROLE_ERROR = 'RECEIVE_MEMBER_ROLE_ERROR';
+export const RECEIVE_MEMBER_EXPIRATION_SUCCESS = 'RECEIVE_MEMBER_EXPIRATION_SUCCESS';
+export const RECEIVE_MEMBER_EXPIRATION_ERROR = 'RECEIVE_MEMBER_EXPIRATION_ERROR';
+
export const HIDE_ERROR = 'HIDE_ERROR';
export const SHOW_REMOVE_GROUP_LINK_MODAL = 'SHOW_REMOVE_GROUP_LINK_MODAL';
diff --git a/app/assets/javascripts/vuex_shared/modules/members/mutations.js b/app/assets/javascripts/vuex_shared/modules/members/mutations.js
index 281c947e68f..2415e744290 100644
--- a/app/assets/javascripts/vuex_shared/modules/members/mutations.js
+++ b/app/assets/javascripts/vuex_shared/modules/members/mutations.js
@@ -19,6 +19,21 @@ export default {
);
state.showError = true;
},
+ [types.RECEIVE_MEMBER_EXPIRATION_SUCCESS](state, { memberId, expiresAt }) {
+ const member = findMember(state, memberId);
+
+ if (!member) {
+ return;
+ }
+
+ Vue.set(member, 'expiresAt', expiresAt);
+ },
+ [types.RECEIVE_MEMBER_EXPIRATION_ERROR](state) {
+ state.errorMessage = s__(
+ "Members|An error occurred while updating the member's expiration date, please try again.",
+ );
+ state.showError = true;
+ },
[types.HIDE_ERROR](state) {
state.showError = false;
state.errorMessage = '';