@selfcommunity/react-ui 0.7.9-alpha.35 → 0.7.9-alpha.36

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.
@@ -77,7 +77,10 @@ function GroupSubscribeButton(inProps) {
77
77
  scGroupsManager
78
78
  .subscribe(scGroup, userId)
79
79
  .then(() => {
80
- onSubscribe && onSubscribe(scGroup, types_1.SCGroupSubscriptionStatusType.SUBSCRIBED);
80
+ onSubscribe &&
81
+ onSubscribe(scGroup, scGroup.privacy === types_1.SCGroupPrivacyType.PRIVATE && scGroup.subscription_status !== types_1.SCGroupSubscriptionStatusType.INVITED
82
+ ? types_1.SCGroupSubscriptionStatusType.REQUESTED
83
+ : types_1.SCGroupSubscriptionStatusType.SUBSCRIBED);
81
84
  })
82
85
  .catch((e) => {
83
86
  utils_1.Logger.error(Errors_1.SCOPE_SC_UI, e);
@@ -55,11 +55,10 @@ function GroupNotification(props) {
55
55
  }), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null }),
56
56
  react_1.default.createElement(UserAvatar_1.default, { hide: !notificationObject.user.community_badge, smaller: true },
57
57
  react_1.default.createElement(material_1.Avatar, { alt: notificationObject.user.username, variant: "circular", src: notificationObject.user.avatar, classes: { root: classes.avatar } }))), primary: react_1.default.createElement(material_1.Box, null,
58
- notificationObject.type !== types_1.SCNotificationTypologyType.USER_ADDED_TO_GROUP && (react_1.default.createElement(react_1.default.Fragment, null,
59
- react_1.default.createElement(react_core_1.Link, Object.assign({}, (!notificationObject.user.deleted && {
60
- to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
61
- }), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }), notificationObject.user.username),
62
- ' ')),
58
+ react_1.default.createElement(react_core_1.Link, Object.assign({}, (!notificationObject.user.deleted && {
59
+ to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
60
+ }), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }), notificationObject.user.username),
61
+ ' ',
63
62
  react_1.default.createElement(react_intl_1.FormattedMessage, { id: `ui.notification.${notificationObject.type}`, defaultMessage: `ui.notification.${notificationObject.type}`, values: {
64
63
  group: notificationObject.group.name,
65
64
  link: (...chunks) => react_1.default.createElement(react_core_1.Link, { to: scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, notificationObject.group) }, chunks)
@@ -211,11 +211,10 @@ function UserNotification(inProps) {
211
211
  }), { onClick: groupNotification.user.deleted ? () => setOpenAlert(true) : null }),
212
212
  react_1.default.createElement(UserAvatar_1.default, { hide: !groupNotification.user.community_badge, smaller: true },
213
213
  react_1.default.createElement(material_1.Avatar, { className: classes.avatar, alt: groupNotification.user.username, variant: "circular", src: groupNotification.user.avatar }))), titleTypographyProps: { className: classes.title, variant: 'subtitle1' }, title: react_1.default.createElement(react_1.default.Fragment, null,
214
- notificationObject.aggregated[0].type !== types_1.SCNotificationTypologyType.USER_ADDED_TO_GROUP && (react_1.default.createElement(react_1.default.Fragment, null,
215
- react_1.default.createElement(react_core_1.Link, Object.assign({}, (!groupNotification.user.deleted && {
216
- to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, groupNotification.user)
217
- }), { onClick: groupNotification.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }), groupNotification.user.username),
218
- ' ')),
214
+ react_1.default.createElement(react_core_1.Link, Object.assign({}, (!groupNotification.user.deleted && {
215
+ to: scRoutingContext.url(react_core_1.SCRoutes.USER_PROFILE_ROUTE_NAME, groupNotification.user)
216
+ }), { onClick: groupNotification.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }), groupNotification.user.username),
217
+ ' ',
219
218
  react_1.default.createElement(react_intl_1.FormattedMessage, { id: `ui.notification.${notificationObject.aggregated[0].type}`, defaultMessage: `ui.notification.${notificationObject.aggregated[0].type}`, values: {
220
219
  group: groupNotification.group.name,
221
220
  link: (...chunks) => react_1.default.createElement(react_core_1.Link, { to: scRoutingContext.url(react_core_1.SCRoutes.GROUP_ROUTE_NAME, groupNotification.group) }, chunks)
@@ -75,7 +75,10 @@ export default function GroupSubscribeButton(inProps) {
75
75
  scGroupsManager
76
76
  .subscribe(scGroup, userId)
77
77
  .then(() => {
78
- onSubscribe && onSubscribe(scGroup, SCGroupSubscriptionStatusType.SUBSCRIBED);
78
+ onSubscribe &&
79
+ onSubscribe(scGroup, scGroup.privacy === SCGroupPrivacyType.PRIVATE && scGroup.subscription_status !== SCGroupSubscriptionStatusType.INVITED
80
+ ? SCGroupSubscriptionStatusType.REQUESTED
81
+ : SCGroupSubscriptionStatusType.SUBSCRIBED);
79
82
  })
80
83
  .catch((e) => {
81
84
  Logger.error(SCOPE_SC_UI, e);
@@ -3,7 +3,7 @@ import React, { useContext, useEffect, useState } from 'react';
3
3
  import { styled } from '@mui/material/styles';
4
4
  import { Avatar, Box, Stack, Typography } from '@mui/material';
5
5
  import { Link, SCRoutes, SCUserContext, useSCRouting } from '@selfcommunity/react-core';
6
- import { SCGroupSubscriptionStatusType, SCNotificationTypologyType } from '@selfcommunity/types';
6
+ import { SCGroupSubscriptionStatusType } from '@selfcommunity/types';
7
7
  import { FormattedMessage } from 'react-intl';
8
8
  import DateTimeAgo from '../../../shared/DateTimeAgo';
9
9
  import classNames from 'classnames';
@@ -53,11 +53,10 @@ export default function GroupNotification(props) {
53
53
  }), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null }),
54
54
  React.createElement(UserAvatar, { hide: !notificationObject.user.community_badge, smaller: true },
55
55
  React.createElement(Avatar, { alt: notificationObject.user.username, variant: "circular", src: notificationObject.user.avatar, classes: { root: classes.avatar } }))), primary: React.createElement(Box, null,
56
- notificationObject.type !== SCNotificationTypologyType.USER_ADDED_TO_GROUP && (React.createElement(React.Fragment, null,
57
- React.createElement(Link, Object.assign({}, (!notificationObject.user.deleted && {
58
- to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
59
- }), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }), notificationObject.user.username),
60
- ' ')),
56
+ React.createElement(Link, Object.assign({}, (!notificationObject.user.deleted && {
57
+ to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, notificationObject.user)
58
+ }), { onClick: notificationObject.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }), notificationObject.user.username),
59
+ ' ',
61
60
  React.createElement(FormattedMessage, { id: `ui.notification.${notificationObject.type}`, defaultMessage: `ui.notification.${notificationObject.type}`, values: {
62
61
  group: notificationObject.group.name,
63
62
  link: (...chunks) => React.createElement(Link, { to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, notificationObject.group) }, chunks)
@@ -209,11 +209,10 @@ export default function UserNotification(inProps) {
209
209
  }), { onClick: groupNotification.user.deleted ? () => setOpenAlert(true) : null }),
210
210
  React.createElement(UserAvatar, { hide: !groupNotification.user.community_badge, smaller: true },
211
211
  React.createElement(Avatar, { className: classes.avatar, alt: groupNotification.user.username, variant: "circular", src: groupNotification.user.avatar }))), titleTypographyProps: { className: classes.title, variant: 'subtitle1' }, title: React.createElement(React.Fragment, null,
212
- notificationObject.aggregated[0].type !== SCNotificationTypologyType.USER_ADDED_TO_GROUP && (React.createElement(React.Fragment, null,
213
- React.createElement(Link, Object.assign({}, (!groupNotification.user.deleted && {
214
- to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, groupNotification.user)
215
- }), { onClick: groupNotification.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }), groupNotification.user.username),
216
- ' ')),
212
+ React.createElement(Link, Object.assign({}, (!groupNotification.user.deleted && {
213
+ to: scRoutingContext.url(SCRoutes.USER_PROFILE_ROUTE_NAME, groupNotification.user)
214
+ }), { onClick: groupNotification.user.deleted ? () => setOpenAlert(true) : null, className: classes.username }), groupNotification.user.username),
215
+ ' ',
217
216
  React.createElement(FormattedMessage, { id: `ui.notification.${notificationObject.aggregated[0].type}`, defaultMessage: `ui.notification.${notificationObject.aggregated[0].type}`, values: {
218
217
  group: groupNotification.group.name,
219
218
  link: (...chunks) => React.createElement(Link, { to: scRoutingContext.url(SCRoutes.GROUP_ROUTE_NAME, groupNotification.group) }, chunks)