Conversation
solb
reviewed
Dec 24, 2020
| } | ||
|
|
||
| function call(method, body, workspace) { | ||
| function authHeaders(workspace) { |
Contributor
There was a problem hiding this comment.
nit: More general name, as it might have other headers in the future
| var options = { | ||
| headers: { | ||
| Authorization: 'Bearer ' + token, | ||
| ...authHeaders(workspace), |
Contributor
There was a problem hiding this comment.
Change this to headers: authHeaders(workspace), (or whatever we call it)
| }; | ||
|
|
||
| var payload = ''; | ||
| var form = undefined; |
Contributor
There was a problem hiding this comment.
If we're making it undefined, why initialize it at all?
| return []; | ||
| } | ||
|
|
||
| // TODO: figure out why this doesn't work |
| return collected; | ||
| } | ||
|
|
||
| async function get_event_files_data(event, workspace) { |
Contributor
There was a problem hiding this comment.
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) |
Contributor
There was a problem hiding this comment.
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 => { |
| } | ||
|
|
||
| if(event.files) { | ||
| const uploaded_files = await upload_files(await get_event_files_data(event, workspace), paired.workspace, paired.channel); |
| "dependencies": { | ||
| "pg": "8.2.0" | ||
| "pg": "8.2.0", | ||
| "form-data": "3.0.0" |
| .map(file => { | ||
| if(!file.mimetype || !file.mimetype.includes('image/')) { | ||
| return { | ||
| text: `<${file.permalink}|${file.name}>` |
Contributor
There was a problem hiding this comment.
This doesn't appear to be working (at least for PDFs)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.