Skip to content

Commit

Permalink
Quick temporary fix for #6
Browse files Browse the repository at this point in the history
  • Loading branch information
iansan5653 committed Sep 27, 2018
1 parent 17a142a commit f9e42ac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Code.js
Original file line number Diff line number Diff line change
Expand Up @@ -1558,9 +1558,14 @@ function buildItemListSlackAttachment(items, projectName, projectSheetUrl, user,
itemListMessage.attachments.push(categoryAttachment);
});

// Safely encode JSON https://stackoverflow.com/a/4253415
attachment.value = JSON.stringify(itemListMessage);

if(attachment.value.length >= 2000) {
itemListMessage.text = "Sorry, there were too many items to list. Open the project sheet to view them instead. https://github.com/usfsoar/purchasing-manager/issues/6";
itemListMessage.attachments = [];
attachment.value = JSON.stringify(itemListMessage);
}

return attachment;
}

Expand Down

0 comments on commit f9e42ac

Please sign in to comment.