Repository: 8398a7/action-slack (ts)

Issue:
@here metion is not happening & Succeeded and Failure icons are also missing
**Describe the bug**
@here metion is not happening & Succeeded and Failure icons are also missing



**Screenshots**
@here mention is not working
![image](https://user-images.githubusercontent.com/18380219/88459680-c4d5c300-ceb4-11ea-9817-0b80a29bb78f.png)



Succeeded and Failed icons are missing
![image](https://user-images.githubusercontent.com/18380219/88459683-d1f2b200-ceb4-11ea-86c1-add8c8dc6b08.png)


Here is the link to actions.yml file - [https://github.com/umapps/UMApps-Test/blob/master/.github/workflows/maven.yml#L27](https://github.com/umapps/UMApps-Test/blob/master/.github/workflows/maven.yml#L27)

Pull request description:
Issue/93
close #93

Patch:
diff --git a/docs/content/with.md b/docs/content/with.md
index b2341cf..64122c7 100644
--- a/docs/content/with.md
+++ b/docs/content/with.md
@@ -12,7 +12,7 @@ This page describes the elements that can be specified in with.
 | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
 | [status](/with#status)                 | `'success'` or `'failure'` or `'cancelled'` or `'custom'`                                                                                                                                            | `''`                    |
 | [fields](/fields)                      | You can choose the items you want to add to the fields at the time of notification.                                                                                                                  | `'repo,commit'`         |
-| [text](/with#text)                     | Specify the text you want to add.                                                                                                                                                                    | `''`                    |
+| [text](/with#text)                     | Specify the text you want to add. All strings will be overwritten.                                                                                                                                   | `''`                    |
 | [author_name](/with#author_name)       | It can be overwritten by specifying. The job name is recommend.                                                                                                                                      | `'8398a7@action-slack'` |
 | [mention](/with#mention)               | `'here'` or `'channel'` or [user_group_id](https://api.slack.com/reference/surfaces/formatting#mentioning-groups) or [user_id](https://api.slack.com/reference/surfaces/formatting#mentioning-users) | `''`                    |
 | [if_mention](/with#mention)            | Specify `'success'` or `'failure'` or `'cancelled'` or `'custom'` or `'always'`.                                                                                                                     | `''`                    |
diff --git a/src/client.ts b/src/client.ts
index f66072e..a790ec0 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -128,6 +128,27 @@ export class Client {
     throw new Error(`invalid status: ${this.with.status}`);
   }
 
+  mentionText(status: SuccessType | FailureType | CancelledType | AlwaysType) {
+    const { mention, if_mention } = this.with;
+    if (!if_mention.includes(status) && if_mention !== Always) {
+      return '';
+    }
+
+    const normalized = mention.replace(/ /g, '');
+    if (normalized !== '') {
+      const text = normalized
+        .split(',')
+        .map(id => this.getIdString(id))
+        .join(' ');
+      return `${text} `;
+    }
+    return '';
+  }
+
+  private insertText(defaultText: string, text: string) {
+    return text === '' ? defaultText : text;
+  }
+
   private async payloadTemplate() {
     const text = '';
     const { username, icon_emoji, icon_url, channel } = this.with;
@@ -149,32 +170,9 @@ export class Client {
   }
 
   private getIdString(id: string): string {
-    if (id.includes(subteamMention)) return `<!${id}>`;
-    else return `<@${id}>`;
-  }
-
-  private mentionText(
-    status: SuccessType | FailureType | CancelledType | AlwaysType,
-  ) {
-    const { mention, if_mention } = this.with;
-    if (!if_mention.includes(status) && if_mention !== Always) {
-      return '';
-    }
-
-    const normalized = mention.replace(/ /g, '');
-    if (groupMention.includes(normalized)) {
-      return `<!${normalized}> `;
-    } else if (normalized !== '') {
-      const text = normalized
-        .split(',')
-        .map(id => this.getIdString(id))
-        .join(' ');
-      return `${text} `;
-    }
-    return '';
-  }
+    if (id.includes(subteamMention) || groupMention.includes(id))
+      return `<!${id}>`;
 
-  private insertText(defaultText: string, text: string) {
-    return text === '' ? defaultText : text;
+    return `<@${id}>`;
   }
 }


Test patch:
diff --git a/__tests__/client.test.ts b/__tests__/client.test.ts
index 6c555c9..cc493c3 100644
--- a/__tests__/client.test.ts
+++ b/__tests__/client.test.ts
@@ -592,4 +592,23 @@ describe('8398a7/action-slack', () => {
       expect(() => client.injectText('')).toThrow();
     });
   });
+  describe('mentionText', () => {
+    it('returns proper user and group mentions', () => {
+      const withParams: With = {
+        status: Success,
+        mention: 'test1,test2, here',
+        author_name: '',
+        if_mention: Success,
+        username: '',
+        icon_emoji: '',
+        icon_url: '',
+        channel: '',
+        fields: '',
+      };
+      const client = new Client(withParams, process.env.GITHUB_TOKEN, '');
+      expect(client.mentionText(Success)).toStrictEqual(
+        '<@test1> <@test2> <!here> ',
+      );
+    });
+  });
 });