@selfcommunity/react-core 0.4.50-events.44 → 0.4.50-events.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -56,8 +56,11 @@ function useSCFetchEvent({ id = null, event = null, autoSubscribe = true, cacheS
56
56
  if (__eventId && scUserContext.user !== undefined && (!scEvent || (scEvent && __eventId !== scEvent.id))) {
57
57
  fetchEvent()
58
58
  .then((event) => {
59
- if (autoSubscribe && authUserId !== null && event.privacy === types_1.SCEventPrivacyType.PUBLIC && !event.subscription_status) {
60
- // Auto subscribe the event
59
+ if (autoSubscribe &&
60
+ authUserId !== null &&
61
+ ((event.privacy === types_1.SCEventPrivacyType.PUBLIC && !event.subscription_status) ||
62
+ (event.privacy === types_1.SCEventPrivacyType.PRIVATE && event.subscription_status === types_1.SCEventSubscriptionStatusType.INVITED))) {
63
+ // Auto subscribe to the event
61
64
  api_services_1.EventService.subscribeToEvent(event.id).then(() => {
62
65
  setSCEvent(event);
63
66
  });
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useMemo, useState } from 'react';
2
2
  import { SCOPE_SC_CORE } from '../constants/Errors';
3
- import { SCEventPrivacyType } from '@selfcommunity/types';
3
+ import { SCEventPrivacyType, SCEventSubscriptionStatusType } from '@selfcommunity/types';
4
4
  import { Endpoints, EventService, http } from '@selfcommunity/api-services';
5
5
  import { CacheStrategies, Logger, LRUCache, objectWithoutProperties } from '@selfcommunity/utils';
6
6
  import { getEventObjectCacheKey } from '../constants/Cache';
@@ -54,8 +54,11 @@ export default function useSCFetchEvent({ id = null, event = null, autoSubscribe
54
54
  if (__eventId && scUserContext.user !== undefined && (!scEvent || (scEvent && __eventId !== scEvent.id))) {
55
55
  fetchEvent()
56
56
  .then((event) => {
57
- if (autoSubscribe && authUserId !== null && event.privacy === SCEventPrivacyType.PUBLIC && !event.subscription_status) {
58
- // Auto subscribe the event
57
+ if (autoSubscribe &&
58
+ authUserId !== null &&
59
+ ((event.privacy === SCEventPrivacyType.PUBLIC && !event.subscription_status) ||
60
+ (event.privacy === SCEventPrivacyType.PRIVATE && event.subscription_status === SCEventSubscriptionStatusType.INVITED))) {
61
+ // Auto subscribe to the event
59
62
  EventService.subscribeToEvent(event.id).then(() => {
60
63
  setSCEvent(event);
61
64
  });