@selfcommunity/react-ui 0.7.0-alpha.355 → 0.7.0-alpha.357

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.
@@ -61,8 +61,6 @@ function ContributionFollowNotification(props) {
61
61
  b: (...chunks) => react_1.default.createElement("strong", null, chunks)
62
62
  })), secondary: react_1.default.createElement(react_1.default.Fragment, null,
63
63
  template === types_1.SCNotificationObjectTemplateType.SNIPPET && (react_1.default.createElement(react_1.default.Fragment, null,
64
- ":",
65
- ' ',
66
64
  react_1.default.createElement(react_core_1.Link, { to: scRoutingContext.url(react_core_1.SCRoutes[`${notificationObject[contributionType]['type'].toUpperCase()}_ROUTE_NAME`], (0, contribution_1.getRouteData)(notificationObject[contributionType])) },
67
65
  react_1.default.createElement(material_1.Typography, { variant: "body2", className: classes.contributionText }, (0, contribution_1.getContributionSnippet)(notificationObject[contributionType]))))),
68
66
  (template === types_1.SCNotificationObjectTemplateType.DETAIL || template === types_1.SCNotificationObjectTemplateType.SNIPPET) && (react_1.default.createElement("div", null,
@@ -144,7 +144,7 @@ function PrivateMessageThread(inProps) {
144
144
  // HOOKS
145
145
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
146
146
  // @ts-ignore
147
- const { scUser } = (0, react_core_1.useSCFetchUser)({ id: isNumber ? userObj : null, userObj });
147
+ const { scUser } = (0, react_core_1.useSCFetchUser)({ id: userObj, userObj });
148
148
  const messagesEndRef = (0, react_1.useRef)(null);
149
149
  const scrollToBottom = () => {
150
150
  var _a;
@@ -290,7 +290,7 @@ function PrivateMessageThread(inProps) {
290
290
  setSingleMessageThread(false);
291
291
  }
292
292
  else {
293
- if (role || _isFollower) {
293
+ if (role || _isFollower || react_core_1.UserUtils.getUserRole(scUser)) {
294
294
  setSingleMessageThread(true);
295
295
  setRecipients(_userObjId);
296
296
  onSingleMessageOpen(true);
@@ -482,7 +482,7 @@ function PrivateMessageThread(inProps) {
482
482
  onMouseEnter: () => handleMouseEnter(msg.id),
483
483
  onMouseLeave: () => handleMouseLeave(msg.id)
484
484
  }, isHovering: isHovered[msg.id], showMenuIcon: authUserId === msg.sender.id, onMenuIconClick: () => handleOpenDeleteMessageDialog(msg) }))))))))),
485
- react_1.default.createElement(PrivateMessageEditor_1.default, { className: classes.editor, send: handleSend, autoHide: !isFollower && !role, autoHideDeletion: (receiver === null || receiver === void 0 ? void 0 : receiver.deleted) || (scUser === null || scUser === void 0 ? void 0 : scUser.deleted), onThreadChangeId: isNumber ? userObj : userObj.receiver.id, error: error, onErrorRemove: () => setError(false) }),
485
+ react_1.default.createElement(PrivateMessageEditor_1.default, { className: classes.editor, send: handleSend, autoHide: !isFollower && (!role || !react_core_1.UserUtils.getUserRole(scUser)), autoHideDeletion: (receiver === null || receiver === void 0 ? void 0 : receiver.deleted) || (scUser === null || scUser === void 0 ? void 0 : scUser.deleted), onThreadChangeId: isNumber ? userObj : userObj.receiver.id, error: error, onErrorRemove: () => setError(false) }),
486
486
  openDeleteMessageDialog && (react_1.default.createElement(ConfirmDialog_1.default, { open: openDeleteMessageDialog, title: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.privateMessage.component.delete.message.dialog.msg", defaultMessage: "ui.privateMessage.component.delete.message.dialog.msg" }), btnConfirm: react_1.default.createElement(react_intl_1.FormattedMessage, { id: "ui.privateMessage.component.delete.message.dialog.confirm", defaultMessage: "ui.privateMessage.component.delete.message.dialog.confirm" }), onConfirm: handleDeleteMessage, onClose: handleCloseDeleteMessageDialog }))));
487
487
  }
488
488
  /**
@@ -141,10 +141,12 @@ function PublicInfo(props) {
141
141
  const camelField = (0, utils_1.camelCase)(field);
142
142
  const _error = error !== null && error[`${camelField}Error`] && error[`${camelField}Error`].error;
143
143
  const component = { element: material_1.TextField };
144
- let label = intl.formatMessage({
145
- id: `ui.userInfo.${camelField}`,
146
- defaultMessage: `ui.userInfo.${camelField}`
147
- });
144
+ let label = metadataDefinitions[field]
145
+ ? metadataDefinitions[field].label
146
+ : intl.formatMessage({
147
+ id: `ui.userInfo.${camelField}`,
148
+ defaultMessage: `ui.userInfo.${camelField}`
149
+ });
148
150
  let props = {
149
151
  InputProps: {
150
152
  endAdornment: react_1.default.createElement(material_1.InputAdornment, { position: "end" }, isSaving && react_1.default.createElement(material_1.CircularProgress, { size: 10 }))
@@ -59,8 +59,6 @@ export default function ContributionFollowNotification(props) {
59
59
  b: (...chunks) => React.createElement("strong", null, chunks)
60
60
  })), secondary: React.createElement(React.Fragment, null,
61
61
  template === SCNotificationObjectTemplateType.SNIPPET && (React.createElement(React.Fragment, null,
62
- ":",
63
- ' ',
64
62
  React.createElement(Link, { to: scRoutingContext.url(SCRoutes[`${notificationObject[contributionType]['type'].toUpperCase()}_ROUTE_NAME`], getRouteData(notificationObject[contributionType])) },
65
63
  React.createElement(Typography, { variant: "body2", className: classes.contributionText }, getContributionSnippet(notificationObject[contributionType]))))),
66
64
  (template === SCNotificationObjectTemplateType.DETAIL || template === SCNotificationObjectTemplateType.SNIPPET) && (React.createElement("div", null,
@@ -142,7 +142,7 @@ export default function PrivateMessageThread(inProps) {
142
142
  // HOOKS
143
143
  // eslint-disable-next-line @typescript-eslint/ban-ts-ignore
144
144
  // @ts-ignore
145
- const { scUser } = useSCFetchUser({ id: isNumber ? userObj : null, userObj });
145
+ const { scUser } = useSCFetchUser({ id: userObj, userObj });
146
146
  const messagesEndRef = useRef(null);
147
147
  const scrollToBottom = () => {
148
148
  var _a;
@@ -288,7 +288,7 @@ export default function PrivateMessageThread(inProps) {
288
288
  setSingleMessageThread(false);
289
289
  }
290
290
  else {
291
- if (role || _isFollower) {
291
+ if (role || _isFollower || UserUtils.getUserRole(scUser)) {
292
292
  setSingleMessageThread(true);
293
293
  setRecipients(_userObjId);
294
294
  onSingleMessageOpen(true);
@@ -480,7 +480,7 @@ export default function PrivateMessageThread(inProps) {
480
480
  onMouseEnter: () => handleMouseEnter(msg.id),
481
481
  onMouseLeave: () => handleMouseLeave(msg.id)
482
482
  }, isHovering: isHovered[msg.id], showMenuIcon: authUserId === msg.sender.id, onMenuIconClick: () => handleOpenDeleteMessageDialog(msg) }))))))))),
483
- React.createElement(PrivateMessageEditor, { className: classes.editor, send: handleSend, autoHide: !isFollower && !role, autoHideDeletion: (receiver === null || receiver === void 0 ? void 0 : receiver.deleted) || (scUser === null || scUser === void 0 ? void 0 : scUser.deleted), onThreadChangeId: isNumber ? userObj : userObj.receiver.id, error: error, onErrorRemove: () => setError(false) }),
483
+ React.createElement(PrivateMessageEditor, { className: classes.editor, send: handleSend, autoHide: !isFollower && (!role || !UserUtils.getUserRole(scUser)), autoHideDeletion: (receiver === null || receiver === void 0 ? void 0 : receiver.deleted) || (scUser === null || scUser === void 0 ? void 0 : scUser.deleted), onThreadChangeId: isNumber ? userObj : userObj.receiver.id, error: error, onErrorRemove: () => setError(false) }),
484
484
  openDeleteMessageDialog && (React.createElement(ConfirmDialog, { open: openDeleteMessageDialog, title: React.createElement(FormattedMessage, { id: "ui.privateMessage.component.delete.message.dialog.msg", defaultMessage: "ui.privateMessage.component.delete.message.dialog.msg" }), btnConfirm: React.createElement(FormattedMessage, { id: "ui.privateMessage.component.delete.message.dialog.confirm", defaultMessage: "ui.privateMessage.component.delete.message.dialog.confirm" }), onConfirm: handleDeleteMessage, onClose: handleCloseDeleteMessageDialog }))));
485
485
  }
486
486
  /**
@@ -139,10 +139,12 @@ export default function PublicInfo(props) {
139
139
  const camelField = camelCase(field);
140
140
  const _error = error !== null && error[`${camelField}Error`] && error[`${camelField}Error`].error;
141
141
  const component = { element: TextField };
142
- let label = intl.formatMessage({
143
- id: `ui.userInfo.${camelField}`,
144
- defaultMessage: `ui.userInfo.${camelField}`
145
- });
142
+ let label = metadataDefinitions[field]
143
+ ? metadataDefinitions[field].label
144
+ : intl.formatMessage({
145
+ id: `ui.userInfo.${camelField}`,
146
+ defaultMessage: `ui.userInfo.${camelField}`
147
+ });
146
148
  let props = {
147
149
  InputProps: {
148
150
  endAdornment: React.createElement(InputAdornment, { position: "end" }, isSaving && React.createElement(CircularProgress, { size: 10 }))