Commit bbdf14ae authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'led/334294-add-awaiting-user-signup-badge' into 'master'

Add badge for invited user

See merge request gitlab-org/gitlab!78407
parents ed97db5b d255256b
...@@ -11,7 +11,9 @@ import { ...@@ -11,7 +11,9 @@ import {
ACTIVE_TAB_QUERY_PARAM_NAME, ACTIVE_TAB_QUERY_PARAM_NAME,
TAB_QUERY_PARAM_VALUES, TAB_QUERY_PARAM_VALUES,
MEMBER_STATE_AWAITING, MEMBER_STATE_AWAITING,
MEMBER_STATE_ACTIVE,
USER_STATE_BLOCKED_PENDING_APPROVAL, USER_STATE_BLOCKED_PENDING_APPROVAL,
BADGE_LABELS_AWAITING_USER_SIGNUP,
BADGE_LABELS_PENDING_OWNER_APPROVAL, BADGE_LABELS_PENDING_OWNER_APPROVAL,
} from '../../constants'; } from '../../constants';
import RemoveGroupLinkModal from '../modals/remove_group_link_modal.vue'; import RemoveGroupLinkModal from '../modals/remove_group_link_modal.vue';
...@@ -154,8 +156,12 @@ export default { ...@@ -154,8 +156,12 @@ export default {
* @see {@link ~/app/serializers/member_entity.rb} * @see {@link ~/app/serializers/member_entity.rb}
* @returns {boolean} * @returns {boolean}
*/ */
isNewUser(memberInviteMetadata) { isNewUser(memberInviteMetadata, memberState) {
return memberInviteMetadata && !memberInviteMetadata.userState; return (
memberInviteMetadata &&
!memberInviteMetadata.userState &&
memberState !== MEMBER_STATE_ACTIVE
);
}, },
/** /**
* Returns whether the user is awaiting root approval * Returns whether the user is awaiting root approval
...@@ -204,6 +210,10 @@ export default { ...@@ -204,6 +210,10 @@ export default {
* @returns {string} * @returns {string}
*/ */
inviteBadge(memberInviteMetadata, memberState) { inviteBadge(memberInviteMetadata, memberState) {
if (this.isNewUser(memberInviteMetadata, memberState)) {
return BADGE_LABELS_AWAITING_USER_SIGNUP;
}
if (this.shouldAddPendingOwnerApprovalBadge(memberInviteMetadata, memberState)) { if (this.shouldAddPendingOwnerApprovalBadge(memberInviteMetadata, memberState)) {
return BADGE_LABELS_PENDING_OWNER_APPROVAL; return BADGE_LABELS_PENDING_OWNER_APPROVAL;
} }
......
...@@ -111,6 +111,7 @@ export const MEMBER_STATE_CREATED = 0; ...@@ -111,6 +111,7 @@ export const MEMBER_STATE_CREATED = 0;
export const MEMBER_STATE_AWAITING = 1; export const MEMBER_STATE_AWAITING = 1;
export const MEMBER_STATE_ACTIVE = 2; export const MEMBER_STATE_ACTIVE = 2;
export const BADGE_LABELS_AWAITING_USER_SIGNUP = __('Awaiting user signup');
export const BADGE_LABELS_PENDING_OWNER_APPROVAL = __('Pending owner approval'); export const BADGE_LABELS_PENDING_OWNER_APPROVAL = __('Pending owner approval');
export const DAYS_TO_EXPIRE_SOON = 7; export const DAYS_TO_EXPIRE_SOON = 7;
......
...@@ -5250,6 +5250,9 @@ msgstr "" ...@@ -5250,6 +5250,9 @@ msgstr ""
msgid "Average per day: %{average}" msgid "Average per day: %{average}"
msgstr "" msgstr ""
msgid "Awaiting user signup"
msgstr ""
msgid "Award added" msgid "Award added"
msgstr "" msgstr ""
......
...@@ -16,6 +16,7 @@ import { ...@@ -16,6 +16,7 @@ import {
MEMBER_STATE_AWAITING, MEMBER_STATE_AWAITING,
MEMBER_STATE_ACTIVE, MEMBER_STATE_ACTIVE,
USER_STATE_BLOCKED_PENDING_APPROVAL, USER_STATE_BLOCKED_PENDING_APPROVAL,
BADGE_LABELS_AWAITING_USER_SIGNUP,
BADGE_LABELS_PENDING_OWNER_APPROVAL, BADGE_LABELS_PENDING_OWNER_APPROVAL,
TAB_QUERY_PARAM_VALUES, TAB_QUERY_PARAM_VALUES,
} from '~/members/constants'; } from '~/members/constants';
...@@ -131,9 +132,9 @@ describe('MembersTable', () => { ...@@ -131,9 +132,9 @@ describe('MembersTable', () => {
describe('Invited column', () => { describe('Invited column', () => {
describe.each` describe.each`
state | userState | expectedBadgeLabel state | userState | expectedBadgeLabel
${MEMBER_STATE_CREATED} | ${null} | ${''} ${MEMBER_STATE_CREATED} | ${null} | ${BADGE_LABELS_AWAITING_USER_SIGNUP}
${MEMBER_STATE_CREATED} | ${USER_STATE_BLOCKED_PENDING_APPROVAL} | ${BADGE_LABELS_PENDING_OWNER_APPROVAL} ${MEMBER_STATE_CREATED} | ${USER_STATE_BLOCKED_PENDING_APPROVAL} | ${BADGE_LABELS_PENDING_OWNER_APPROVAL}
${MEMBER_STATE_AWAITING} | ${''} | ${''} ${MEMBER_STATE_AWAITING} | ${''} | ${BADGE_LABELS_AWAITING_USER_SIGNUP}
${MEMBER_STATE_AWAITING} | ${USER_STATE_BLOCKED_PENDING_APPROVAL} | ${BADGE_LABELS_PENDING_OWNER_APPROVAL} ${MEMBER_STATE_AWAITING} | ${USER_STATE_BLOCKED_PENDING_APPROVAL} | ${BADGE_LABELS_PENDING_OWNER_APPROVAL}
${MEMBER_STATE_AWAITING} | ${'something_else'} | ${BADGE_LABELS_PENDING_OWNER_APPROVAL} ${MEMBER_STATE_AWAITING} | ${'something_else'} | ${BADGE_LABELS_PENDING_OWNER_APPROVAL}
${MEMBER_STATE_ACTIVE} | ${null} | ${''} ${MEMBER_STATE_ACTIVE} | ${null} | ${''}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment