-
Notifications
You must be signed in to change notification settings - Fork 730
Reddit integration #351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Reddit integration #351
Changes from all commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
cede56e
Added Pizzly
a45890e
Added frontend
337c429
Pizzly not yet working
387edcb
Added flow
743492b
NA
57052fd
Getting reddit posts with Pizzly
c53f06f
Setting up reddit on sign-up
c6bd348
Started recursive function for comments
c4094a6
Getting a big set of comments
22faf71
Working
4fb41bc
Added Pizzly
a01a251
Added frontend
6f614cf
Pizzly not yet working
47059da
Added flow
610dc5c
NA
5097622
Getting reddit posts with Pizzly
9f27118
Setting up reddit on sign-up
3dfca0a
Started recursive function for comments
2dec380
Getting a big set of comments
9879a55
First commit of reddit connect flow
mariobalca b18639a
Fix reddit/activity-type-message and translations
mariobalca 7d270c9
Better cli, comments, and securing Pizzly
dfe58ec
Added vars to docker entrypoint
1ae0296
Merge branch 'feature/reddit-integration-frontend' into feature/reddi…
91a47b0
Fix connect
8a1aa9b
Fix activities HTML
012e4fd
Added subreddit validation
b8c01a2
Format
6d948dd
Track events
a421c92
Moved to Pizzly 0.4.0
1fd7300
Address QA items related to frontend
mariobalca a375cf6
Fix member-channels.vue
mariobalca d66526b
Add replace for r/
mariobalca f45d917
Copy tweaks
mariobalca f39dc09
Merge branch 'main' into feature/reddit-integration
f536d06
Format
79e6418
Merge branch 'feature/reddit-integration' of github.com:CrowdDotDev/c…
aaaa294
Fix reddit-activity-message.vue missing short prop
mariobalca 683c98f
Format
eb6ec7a
Merge branch 'feature/reddit-integration' of github.com:CrowdDotDev/c…
79ef41e
Format
d1c542b
Fixed merge error with PostHog
84069a0
Changed order of integrations and added copy for the drawer
177316e
Copy tweak
a8b73c6
Event tracking
1570259
Fix track
cd3ace7
Format
d90f3ab
Removed isStreamFinished
777ef3b
Log
4e60891
Format
da6b44e
Lint
62b2191
Removed ability to add more subreddits
4c0e891
Added Throttling
ee68574
Merge branch 'main' into feature/reddit-integration
2bd5230
Merge branch 'main' into feature/reddit-integration
995c136
Update colors of reddit and hackernews integrations
mariobalca File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Permissions from '../../../security/permissions' | ||
import IntegrationService from '../../../services/integrationService' | ||
import PermissionChecker from '../../../services/user/permissionChecker' | ||
|
||
export default async (req, res) => { | ||
new PermissionChecker(req).validateHas(Permissions.values.tenantEdit) | ||
const payload = await new IntegrationService(req).redditOnboard(req.body.subreddits) | ||
await req.responseHandler.success(req, res, payload) | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import axios from 'axios' | ||
import Error400 from '../../../errors/Error400' | ||
import Permissions from '../../../security/permissions' | ||
import PermissionChecker from '../../../services/user/permissionChecker' | ||
import track from '../../../segment/track' | ||
|
||
export default async (req, res) => { | ||
new PermissionChecker(req).validateHasAny([ | ||
Permissions.values.integrationCreate, | ||
Permissions.values.integrationEdit, | ||
]) | ||
|
||
if (req.query.subreddit) { | ||
try { | ||
const result = await axios.get( | ||
`https://www.reddit.com/r/${req.query.subreddit}/new.json?limit=1`, | ||
) | ||
if ( | ||
result.status === 200 && | ||
result.data.data.children && | ||
result.data.data.children.length > 0 | ||
) { | ||
console.log('here') | ||
track( | ||
'Reddit: subreddit input', | ||
{ | ||
subreddit: req.query.subreddit, | ||
valid: true, | ||
}, | ||
{ ...req }, | ||
) | ||
return req.responseHandler.success(req, res, result.data.data.children) | ||
} | ||
} catch (e) { | ||
track( | ||
'Reddit: subreddit input', | ||
{ | ||
subreddit: req.query.subreddit, | ||
valid: false, | ||
}, | ||
{ ...req }, | ||
) | ||
return req.responseHandler.error(req, res, new Error400(req.language)) | ||
} | ||
} | ||
track( | ||
'Reddit: subreddit input', | ||
{ | ||
subreddit: req.query.subreddit, | ||
valid: false, | ||
}, | ||
{ ...req }, | ||
) | ||
return req.responseHandler.error(req, res, new Error400(req.language)) | ||
} |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Attribute } from '../attribute' | ||
import { AttributeType } from '../types' | ||
import { MemberAttributes, MemberAttributeName } from './enums' | ||
|
||
export const RedditMemberAttributes: Attribute[] = [ | ||
{ | ||
name: MemberAttributes[MemberAttributeName.SOURCE_ID].name, | ||
label: MemberAttributes[MemberAttributeName.SOURCE_ID].label, | ||
type: AttributeType.STRING, | ||
canDelete: false, | ||
show: false, | ||
}, | ||
{ | ||
name: MemberAttributes[MemberAttributeName.URL].name, | ||
label: MemberAttributes[MemberAttributeName.URL].label, | ||
type: AttributeType.URL, | ||
canDelete: false, | ||
show: true, | ||
}, | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { gridEntry } from './grid' | ||
|
||
export class RedditGrid { | ||
static post: gridEntry = { | ||
score: 10, | ||
isKeyAction: true, | ||
} | ||
|
||
static comment: gridEntry = { | ||
score: 6, | ||
isKeyAction: true, | ||
} | ||
} |
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we be validating the
Permissions.values.integrationCreate
instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, actually. All integrations are like this, though. I will create an issue to move all.