Skip to content

Conversation

@joshua-cain
Copy link

No description provided.

@joshua-cain joshua-cain requested a review from solb December 24, 2020 01:46
}

function call(method, body, workspace) {
function authHeaders(workspace) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: More general name, as it might have other headers in the future

var options = {
headers: {
Authorization: 'Bearer ' + token,
...authHeaders(workspace),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change this to headers: authHeaders(workspace), (or whatever we call it)

};

var payload = '';
var form = undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're making it undefined, why initialize it at all?

return [];
}

// TODO: figure out why this doesn't work
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop this. Rebase mistake?

return collected;
}

async function get_event_files_data(event, workspace) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have this accept a files array instead of an event

if(event.files) {
const uploaded_files = await upload_files(await get_event_files_data(event, workspace), paired.workspace, paired.channel);
message.attachments = uploaded_files
.filter(file => typeof file === 'object' && file.permalink)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove filter() because we can trust upload_files().

const uploaded_files = await upload_files(await get_event_files_data(event, workspace), paired.workspace, paired.channel);
message.attachments = uploaded_files
.filter(file => typeof file === 'object' && file.permalink)
.map(file => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Closure style

}

if(event.files) {
const uploaded_files = await upload_files(await get_event_files_data(event, workspace), paired.workspace, paired.channel);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: const

"dependencies": {
"pg": "8.2.0"
"pg": "8.2.0",
"form-data": "3.0.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please alphabetize

.map(file => {
if(!file.mimetype || !file.mimetype.includes('image/')) {
return {
text: `<${file.permalink}|${file.name}>`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't appear to be working (at least for PDFs)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants