diff --git a/website/client/src/components/group-plans/groupPlanSelectionModal.vue b/website/client/src/components/group-plans/groupPlanSelectionModal.vue index 77573138ac..87f6c0d247 100644 --- a/website/client/src/components/group-plans/groupPlanSelectionModal.vue +++ b/website/client/src/components/group-plans/groupPlanSelectionModal.vue @@ -77,6 +77,7 @@ @@ -87,6 +88,12 @@
{{ formatMemberCount(upgradeableParty.memberCount) }} + + {{ $t('pendingCount', { count: partyPendingInviteCount }) }} +
+
+
+ {{ $t('upgradeCancelsPendingInvites') }} +
@@ -368,6 +427,7 @@ import { mapState } from '@/libs/store'; import SelectableCard from '@/components/ui/selectableCard.vue'; import svgSparkles from '@/assets/svg/sparkles.svg?raw'; import svgMember from '@/assets/svg/member-icon.svg?raw'; +import svgAlert from '@/assets/svg/for-css/alert.svg?raw'; export default { components: { @@ -386,7 +446,9 @@ export default { icons: Object.freeze({ sparkles: svgSparkles, member: svgMember, + alert: svgAlert, }), + partyPendingInviteCount: 0, }; }, computed: { @@ -420,6 +482,7 @@ export default { async loadData () { this.loading = true; this.selectedOption = null; + this.partyPendingInviteCount = 0; try { const [guildsResponse, partyResponse] = await Promise.all([ @@ -430,6 +493,15 @@ export default { this.userGuilds = guildsResponse.data.data || []; this.userParty = partyResponse.data.data; + if (this.userParty) { + try { + const invitesResponse = await axios.get(`/api/v4/groups/${this.userParty._id}/invites`); + this.partyPendingInviteCount = invitesResponse.data.data?.length || 0; + } catch (e) { + this.partyPendingInviteCount = 0; + } + } + await this.$store.dispatch('guilds:getGroupPlans', true); const groupPlans = this.$store.state.groupPlans?.data || []; this.activeGroupPlanIds = groupPlans.map(g => g._id); diff --git a/website/common/locales/en/groups.json b/website/common/locales/en/groups.json index c287f6047b..b5c5c64a3f 100644 --- a/website/common/locales/en/groups.json +++ b/website/common/locales/en/groups.json @@ -438,5 +438,7 @@ "perMember": "per member", "additionalMembersProrated": "Additional members invited during the month will be added to the next billing cycle's total as a pro-rated charge.", "oneMember": "1 member", - "membersCount": "<%= count %> members" + "membersCount": "<%= count %> members", + "pendingCount": "(<%= count %> pending)", + "upgradeCancelsPendingInvites": "Upgrading your Party will cancel all pending invites" } diff --git a/website/server/libs/payments/subscriptions.js b/website/server/libs/payments/subscriptions.js index 93ff285b41..9a0dd3126c 100644 --- a/website/server/libs/payments/subscriptions.js +++ b/website/server/libs/payments/subscriptions.js @@ -153,6 +153,10 @@ async function prepareSubscriptionValues (data) { groupId = group._id; recipient.purchased.plan.quantity = data.sub.quantity; + if (group.type === 'party') { + await group.removeGroupInvitations(); + } + await addSubscriptionToGroupUsers(group); }