-
-
Notifications
You must be signed in to change notification settings - Fork 881
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finish #3123: "reddit" media host, for image posts that link to comme…
…nts page (#3156) * don't expando pixel.redditmedia.com (promoted post clickthrough urls) * ignore nyc outut * utils.getPostMetadata fetch API response for (many batched) reddit posts * comments regex returns post ID * show expando on post's original url if post links to comments+preview * showImages.options.expandoCommentRedirects to control handling of posts redirecting to comments either: ignore them, hit the api to get the expando, or hit the api to get the expando and also change the link to point to said expando's image
- Loading branch information
1 parent
f61d0da
commit 2c5aaee
Showing
7 changed files
with
100 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,3 +67,4 @@ $RECYCLE.BIN/ | |
## IntelliJ | ||
.idea | ||
*.iml | ||
.nyc_output |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { ajax } from '../environment'; | ||
import { batch } from './async'; | ||
|
||
export const getPostMetadata = batch(async requests => { | ||
const byId = requests | ||
.map(r => r.id) | ||
.map(id => `t3_${id}`) | ||
.join(','); | ||
|
||
const { data: { children } } = await ajax({ | ||
url: `/by_id/${byId}.json`, | ||
data: { limit: 100 }, | ||
type: 'json', | ||
}); | ||
|
||
return children.map(c => c.data); | ||
}, { size: 100 }); |