@rh-support/troubleshoot 1.0.5 → 1.0.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"PostComment.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/PostComment.tsx"],"names":[],"mappings":"AAqCA,OAAO,EAAkB,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAqB5F,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,WAAW,EAAE,CAAC;CACjC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,eAwexC"}
1
+ {"version":3,"file":"PostComment.d.ts","sourceRoot":"","sources":["../../../../../../src/components/CaseEditView/Tabs/CaseDiscussion/PostComment.tsx"],"names":[],"mappings":"AAqCA,OAAO,EAAkB,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAqB5F,UAAU,MAAM;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,EAAE,WAAW,EAAE,CAAC;CACjC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,eAqfxC"}
@@ -126,6 +126,7 @@ export function PostComment(props) {
126
126
  }
127
127
  CaseDetailsCacheUtils.set(CaseDetailsCacheNamespaces.COMMENTS_DRAFT.name, loggedInUserRights.data.getSSOUsername(), { value: prevDraftComments });
128
128
  props.onCommentClear && props.onCommentClear();
129
+ setCommentText(`\n ${commentSignature}` || '');
129
130
  });
130
131
  const resetAttachmentSection = () => {
131
132
  resetAttachment(dispatchToAttachmentReducer);
@@ -209,9 +210,16 @@ export function PostComment(props) {
209
210
  .reduce((acc, line) => (acc += '> ' + line + '\n'), person);
210
211
  return reply;
211
212
  };
212
- const addCommentSignature = (preSigCommemnt) => {
213
+ const addCommentSignature = (preSigComment) => {
213
214
  if (!isEmpty(commentSignature)) {
214
- let signedComment = preSigCommemnt + '\n' + commentSignature;
215
+ let signedComment = '';
216
+ // Checks if somment signature already exists and depending on that check, adds the signature
217
+ if (preSigComment.includes(commentSignature)) {
218
+ signedComment = preSigComment;
219
+ }
220
+ else {
221
+ signedComment = preSigComment + '\n' + commentSignature;
222
+ }
215
223
  setCommentText(signedComment);
216
224
  }
217
225
  };
@@ -285,20 +293,22 @@ export function PostComment(props) {
285
293
  const isNotInternalConfirm = () => {
286
294
  onPostComment();
287
295
  };
288
- const onConfirm = (commentText) => __awaiter(this, void 0, void 0, function* () {
289
- yield setIsModalOpen(false);
296
+ const onConfirm = (commentText) => {
297
+ setIsModalOpen(false);
290
298
  isNotInternalConfirm();
291
- });
299
+ };
292
300
  const onBtnClick = () => {
293
301
  setIsModalOpen(true);
294
302
  };
295
303
  // To check is commment is empty
296
- const isCommentEmpty = isEmpty(commentText === null || commentText === void 0 ? void 0 : commentText.trim());
304
+ const checkCommentSignature = commentText.replace(commentSignature, '');
305
+ const isCommentEmpty = isEmpty(checkCommentSignature === null || checkCommentSignature === void 0 ? void 0 : checkCommentSignature.trim());
297
306
  // To check is comment reply is empty and disable if it is
298
307
  const isReplyDisabled = () => {
299
308
  let parsedPassedReply = getReplyText(passedReply, props.commentCreator);
300
309
  return (parsedPassedReply === null || parsedPassedReply === void 0 ? void 0 : parsedPassedReply.trim()) === (commentText === null || commentText === void 0 ? void 0 : commentText.trim());
301
310
  };
311
+ const isSubmitDisabled = isReplyDisabled() || isCommentEmpty || isPostCommentDisabled;
302
312
  return (React.createElement("div", { className: "pf-u-mb-md hide-in-pdf", ref: componentRef },
303
313
  React.createElement(MarkdownEditor, { className: `${!isPublic ? 'is-private' : ''}`, disabled: isProcessing || canEditCase.isCaseNotEditable, "aria-label": "comment text area", showMarkdownPlainTextToggle: true, editorMode: commentType, onFocus: () => setIsTextAreaFocused(true), onBlur: onTextAreaBlur, onChange: onCommentTextChange, value: commentText, rows: isTextAreaFocused ? 12 : 4, bindTextArea: textAreaRef, onCommentExceedCharsLimit: onCommentExceedCharsLimit, mdPlaceholder: isPublic ? 'Add a comment using markdown' : 'Add a comment or attach a file privately', plainTextPlaceholder: isPublic ? 'Add a comment to this case' : 'Add a comment or attach a file privately', fileSelectorProps: {
304
314
  showFileSelectorInToolbar: !loggedInUsersAccount.data.secureSupport,
@@ -312,7 +322,7 @@ export function PostComment(props) {
312
322
  } }),
313
323
  isProcessing ? (React.createElement(LoadingIndicator, { isInline: true, size: "sm" })) : (React.createElement("div", { className: "pf-l-flex post-comment-btn-group push-top-narrow" },
314
324
  isModalOpen && loggedInUserRights.data.isInternal() && isPublic && (React.createElement(VerifyCaseStatusModal, { onClose: onCancel, onConfirm: onConfirm, isUpdating: isPostingComment, caseNumber: props.caseNumber })),
315
- React.createElement(Button, { "data-tracking-id": "postcomment-submit-button", type: "button", variant: ButtonVariant.primary, onClick: loggedInUser.data.isInternal && isPublic ? onBtnClick : isNotInternalConfirm, isDisabled: isReplyDisabled() || isCommentEmpty || isPostCommentDisabled, className: "postcomment-submit" },
325
+ React.createElement(Button, { "data-tracking-id": "postcomment-submit-button", type: "button", variant: ButtonVariant.primary, onClick: loggedInUser.data.isInternal && isPublic ? onBtnClick : isNotInternalConfirm, isDisabled: isSubmitDisabled, className: "postcomment-submit" },
316
326
  React.createElement(Trans, null, "Submit")),
317
327
  canAddAttachments &&
318
328
  (isPublic && canPostPrivateComments ? (React.createElement(Tooltip, { content: t('You can attach files privately') }, fileUploadButton)) : (fileUploadButton)),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rh-support/troubleshoot",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -73,11 +73,11 @@
73
73
  "@patternfly/react-core": "4.202.16",
74
74
  "@progress/kendo-drawing": "^1.6.0",
75
75
  "@progress/kendo-react-pdf": "^3.12.0",
76
- "@rh-support/components": "1.2.3",
77
- "@rh-support/react-context": "1.0.4",
76
+ "@rh-support/components": "1.2.4",
77
+ "@rh-support/react-context": "1.0.5",
78
78
  "@rh-support/types": "0.2.0",
79
- "@rh-support/user-permissions": "1.0.3",
80
- "@rh-support/utils": "1.0.2",
79
+ "@rh-support/user-permissions": "1.0.4",
80
+ "@rh-support/utils": "1.0.3",
81
81
  "@types/react-redux": "^7.1.12",
82
82
  "@types/redux": "^3.6.0",
83
83
  "@webcomponents/webcomponentsjs": "^2.2.10",
@@ -142,5 +142,5 @@
142
142
  "not ie <= 11",
143
143
  "not op_mini all"
144
144
  ],
145
- "gitHead": "8891e192aa5a3aef7b3b456fed64ef5ad68afa47"
145
+ "gitHead": "b69cce6cf363373e3cb9ea6bbfc0515b04974f3a"
146
146
  }