mirror of
https://github.com/gurnec/removeddit.git
synced 2026-03-11 08:54:27 +00:00
Fixed a bug where it would not properly detect removed threads
This commit is contained in:
parent
cefd05494e
commit
4727d6961c
7 changed files with 22 additions and 12 deletions
4
TODO
4
TODO
|
|
@ -4,4 +4,6 @@ update header links active (NavLinks)
|
|||
|
||||
make sort/filter state local
|
||||
|
||||
old.removeddit.com
|
||||
old.removeddit.com
|
||||
|
||||
gzip on server
|
||||
|
|
@ -8,7 +8,7 @@ import Header from './pages/common/Header'
|
|||
import About from './pages/about'
|
||||
import Subreddit from './pages/subreddit'
|
||||
import Thread from './pages/thread'
|
||||
import NotFound from './pages/notFound'
|
||||
import NotFound from './pages/404'
|
||||
|
||||
ReactDOM.render(
|
||||
<Provider>
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ export default (props) => {
|
|||
}
|
||||
|
||||
return (
|
||||
<div className={`thread ${props.removed && 'removed'}`}>
|
||||
<div className={`thread ${props.removed && 'removed'} ${props.deleted && 'deleted'}`}>
|
||||
{props.position &&
|
||||
<span className='post-rank'>{props.position}</span>}
|
||||
<div className='thread-score-box'>
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ const Comment = (props) => {
|
|||
<Comment
|
||||
key={comment.id}
|
||||
{...comment}
|
||||
depth={props.depth + 1}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -110,12 +110,15 @@ const commentSection = (props) => {
|
|||
console.timeEnd('render comment section')
|
||||
|
||||
return (
|
||||
commentTree.map(comment => (
|
||||
<Comment
|
||||
key={comment.id}
|
||||
{...comment}
|
||||
/>
|
||||
))
|
||||
commentTree.length !== 0
|
||||
? commentTree.map(comment => (
|
||||
<Comment
|
||||
key={comment.id}
|
||||
{...comment}
|
||||
depth={0}
|
||||
/>
|
||||
))
|
||||
: <p>No comments found</p>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,10 +33,14 @@ class Thread extends React.Component {
|
|||
this.setState({ post })
|
||||
document.title = post.title
|
||||
// Fetch the thread from pushshift if it was deleted/removed
|
||||
if (isDeleted(post.selftext)) {
|
||||
if (isDeleted(post.selftext) || isRemoved(post.selftext)) {
|
||||
getRemovedPost(threadID)
|
||||
.then(removedPost => {
|
||||
removedPost.removed = true
|
||||
if (isRemoved(post.selftext)) {
|
||||
removedPost.removed = true
|
||||
} else {
|
||||
removedPost.deleted = true
|
||||
}
|
||||
this.setState({ post: removedPost })
|
||||
})
|
||||
}
|
||||
|
|
@ -104,7 +108,7 @@ class Thread extends React.Component {
|
|||
<React.Fragment>
|
||||
<Post {...this.state.post} />
|
||||
{
|
||||
!this.state.loadingComments &&
|
||||
(!this.state.loadingComments && root) &&
|
||||
<React.Fragment>
|
||||
<CommentInfo
|
||||
total={this.state.pushshiftComments.length}
|
||||
|
|
|
|||
Loading…
Reference in a new issue