-
Notifications
You must be signed in to change notification settings - Fork 3
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
[feature] fetch all replies #8
Conversation
…hat asks for the context of the post and then uses the search function to search for all the relevant posts and add them to the database
- Connect the search result completion to the updateContexts function to add posts as they are fetched. - Also works with progress bar - Add alert to indicate how many statuses are being fetched.
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.
minor comments on documentation, status visibility, non-mastodon domain handling, and accessibility.
dispatch(fetchExternalContextRequest(id)); | ||
|
||
api(getState).get(`${origin}/api/v1/statuses/${external_id}/context`).then(response => { | ||
dispatch(showAlert('Getting Replies...', `Getting ${response.data.descendants.length} Replies.`)); |
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.
Todo: We could maybe make this alert more accessible? It is currently in English. If possible, we could enable translation into other languages in the future.
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.
good point, I gotta see how the translation system works and then I'll change
// Get just the protocol and domain of the instance | ||
// note that we are just assuming that the api is at <domain>/api | ||
// since I don't know a better way of finding it | ||
let { origin, pathname } = new URL(status_url); |
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.
we could maybe add examples here in the comments for newbies like me? :) Like: status_url = "https://origin/@user_id/external_id" where user_id is the OP's user id on the origin instance and external_id is the OP's status id? (dunno if I've got this right tho, lol)
return (dispatch, getState) => { | ||
dispatch(fetchExternalContextRequest(id)); | ||
|
||
api(getState).get(`${origin}/api/v1/statuses/${external_id}/context`).then(response => { |
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.
should we do a check here whether the protocol property of ${origin} contains https or not? just for security to avoid sending a request to an http server?
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.
ToDo: we'd need to add handlers for non-mastodon softwares
id, | ||
ancestors, | ||
descendants, | ||
statuses: ancestors.concat(descendants), |
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.
should we concat only those descendants where visibility = public
? not sure what the guidelines are for statuses that have opted out of discovery (e.g where visibility = unlisted
)?
// since I don't know a better way of finding it | ||
let { origin, pathname } = new URL(status_url); | ||
let paths = pathname.split('/'); | ||
let external_id = paths[paths.length - 1]; |
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.
just wondering is external_id = id
also true here?? based on app/javascript/flavours/glitch/features/status/index.js#L470 : this.props.dispatch(fetchExternalContext(status.get('url'), statusId));
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.
no i don't think so, each instance makes its own local IDs for posts that it uses internally which don't necessarily match the Ids used by other instances.
This pull request has merge conflicts that must be resolved before it can be merged. |
Closing in favor of: #44 |
Adds a button to the bottom of an expanded status to fetch all replies from the OP server (or as many as they will give us).
The feature:
It also:
Still to do: