Skip to content

Commit

Permalink
fix error not getting added and fix resending
Browse files Browse the repository at this point in the history
  • Loading branch information
rohit-gohri committed Apr 3, 2019
1 parent 38264bc commit 1cc7a04
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ function getSlackConf() {
}

/**
* @returns {attach}
* @returns {attach[]}
*/
function getDefaultAttachment() {
function getDefaultAttachments() {
const {name, version} = getPackageInfo();
const fields = [
{
Expand Down Expand Up @@ -72,9 +72,9 @@ function getDefaultAttachment() {
});
}

return {
return [{
fields,
};
}];
}

class Slack {
Expand Down Expand Up @@ -118,7 +118,7 @@ class Slack {
*/
attachment(attachments) {
if (!Array.isArray(attachments)) attachments = [attachments];
this._attachments.concat(attachments);
this._attachments = this._attachments.concat(attachments);
return this;
}

Expand Down Expand Up @@ -229,12 +229,12 @@ class Slack {
attachments = [],
extraProps = {},
} = {}) {
attachments.push(getDefaultAttachment());
const finalAttachments = attachments.concat(getDefaultAttachments());
const message = Object.assign(extraProps, {
text,
channel,
username: this.username,
attachments: JSON.stringify(attachments),
attachments: JSON.stringify(finalAttachments),
});

if (this.logCondition()) {
Expand Down

0 comments on commit 1cc7a04

Please sign in to comment.