Skip to content

Commit f2345da

Browse files
authored
Merge branch 'staging' into ISSUE_4639
2 parents e465710 + 3e0ccff commit f2345da

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

backend/src/v5/utils/quota.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Quota.getQuotaInfo = async (teamspace) => {
3535
// paypal subs have a different schema - and no oen should have an active paypal sub. Skip.
3636
if (key !== 'paypal') {
3737
userHasHadPaidPlan = true;
38-
const { expiryDate, data, collaborators: subCollaborators } = subs[key];
38+
const { expiryDate, data, collaborators: subCollaborators = 0 } = subs[key];
3939

4040
if (!expiryDate || expiryDate > Date.now()) {
4141
freeTier = false;

backend/tests/v5/unit/utils/quota.test.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const testGetQuotaInfo = () => {
3333
const tsWithMultipleLicense2 = 'multiLicense2';
3434
const tsWithSomeUsage = 'withUsage';
3535
const tsWithFreeQuota = 'freeQuota';
36+
const tsWithNoCollabs = 'tsWithNoCollabs';
3637

3738
const validExpiryDate = Date.now() + 100000;
3839
const subsByTeamspace = {
@@ -86,6 +87,13 @@ const testGetQuotaInfo = () => {
8687
},
8788

8889
[tsWithFreeQuota]: {},
90+
91+
[tsWithNoCollabs]: {
92+
enterprise: {
93+
data: 1,
94+
expiryDate: validExpiryDate,
95+
},
96+
},
8997
};
9098

9199
DBHandler.findOne.mockImplementation((ts, col, { _id }) => {
@@ -100,6 +108,7 @@ const testGetQuotaInfo = () => {
100108
['Teamspace with sufficient quota (multiple license)', tsWithMultipleLicense, 1024 * 1024 * 5, 9, validExpiryDate - 10, false],
101109
['Teamspace with sufficient quota (multiple license v2)', tsWithMultipleLicense2, 1024 * 1024 * 3, 'unlimited', validExpiryDate, false],
102110
['Teamspace with sufficient quota (with existing usage)', tsWithSomeUsage, 1024 * 1024 * 2, 3, validExpiryDate, false],
111+
['Teamspace with no collaborators (with existing usage)', tsWithNoCollabs, 1024 * 1024 * 2, config.subscriptions.basic.collaborators, validExpiryDate, false],
103112
])('Return quota info', (desc, teamspace, size, collaborators, expiryDate, freeTier, error) => {
104113
test(`${desc} should ${error ? `fail with ${error.code}` : 'should return quota info'}`, async () => {
105114
const quotaInfoProm = Quota.getQuotaInfo(teamspace);

frontend/src/v5/services/realtime/ticket.events.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { getMeshIDsByQuery } from '@/v4/services/api';
2222
import { meshObjectsToV5GroupNode } from '@/v5/helpers/viewpoint.helpers';
2323
import { subscribeToRoomEvent } from './realtime.service';
2424
import { TicketsActionsDispatchers } from '../actionsDispatchers';
25+
import { fetchTicketGroup } from '../api/tickets';
2526

2627
// Container ticket
2728
export const enableRealtimeContainerUpdateTicket = (teamspace: string, project: string, containerId: string) => (
@@ -52,6 +53,10 @@ export const enableRealtimeContainerUpdateTicketGroup = (teamspace: string, proj
5253
const { data } = await getMeshIDsByQuery(teamspace, containerId, group.rules, revision);
5354
// eslint-disable-next-line no-param-reassign
5455
group.objects = meshObjectsToV5GroupNode(data);
56+
// eslint-disable-next-line no-underscore-dangle
57+
} else if (group.objects.some((o) => !o._ids)) {
58+
const { objects } = await fetchTicketGroup(teamspace, project, containerId, group.ticket, group._id, false);
59+
group.objects = objects;
5560
}
5661
TicketsActionsDispatchers.updateTicketGroupSuccess(group);
5762
},
@@ -87,6 +92,10 @@ export const enableRealtimeFederationUpdateTicketGroup = (teamspace: string, pro
8792
const { data } = await getMeshIDsByQuery(teamspace, federationId, group.rules, revision);
8893
// eslint-disable-next-line no-param-reassign
8994
group.objects = meshObjectsToV5GroupNode(data);
95+
// eslint-disable-next-line no-underscore-dangle
96+
} else if (group.objects.some((o) => !o._ids)) {
97+
const { objects } = await fetchTicketGroup(teamspace, project, federationId, group.ticket, group._id, true);
98+
group.objects = objects;
9099
}
91100
TicketsActionsDispatchers.updateTicketGroupSuccess(group);
92101
},

frontend/src/v5/store/tickets/tickets.types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export interface IGroupRule {
135135
export type Group = {
136136
_id?: string,
137137
name: string,
138+
ticket?: string,
138139
description?: string,
139140
objects?: { container: string, _ids: string[] }[],
140141
rules?: IGroupRule[],

0 commit comments

Comments
 (0)