Skip to content
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

add basic spam handler #27

Merged
merged 4 commits into from
Jul 2, 2018
Merged

add basic spam handler #27

merged 4 commits into from
Jul 2, 2018

Conversation

nsiregar
Copy link
Owner

@nsiregar nsiregar commented Jul 1, 2018

No description provided.

@nsiregar nsiregar requested a review from rezhajulio July 1, 2018 22:05
def mark_spam(post_id, id):
comments = Comment.query.get(int(id))
comments.is_spam = True
db.session.commit()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perlu db.session.add(comment) ga sih ?
gw masih awam sqlalchemy

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nggak, kalau add kan insert

@comment.route("/comment/<int:post_id>/<int:id>", methods=["GET"])
@requires_roles("admin", "momod")
def mark_spam(post_id, id):
comments = Comment.query.get(int(id))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oiya ini cuma satu, harusnya comment aja instead of comments

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh takut overwrite blueprint nya ya...

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep

@rezhajulio
Copy link
Collaborator

Oiya karena kita munculin commentnya recursive, kalau comment marked as spam, reply nya jadi ikut ga muncul karena ga ada parent nya. Expected begini atau mau gimana ?

@nsiregar
Copy link
Owner Author

nsiregar commented Jul 2, 2018

harusnya ketika komentar spam di delete, childnya ga muncul. karena kalau muncul dia jadi out scope ya?

@nsiregar
Copy link
Owner Author

nsiregar commented Jul 2, 2018

btw ane kelupaan keknya, kalau dimark spam harusnya dia kaga keitung waktu di viewnya. jadi total comment yang tampil adalah komen yang bukan spam. bener ga sih?

@rezhajulio
Copy link
Collaborator

rezhajulio commented Jul 2, 2018

Tapi kalo gitu kesian juga sih yg reply tapi ga muncul.
Mending kayak reddit kali ya, deleted komen tapi objek komennya ga dihapus, cuma pas di view munculnya deleted. Nah ini spam munculin aja tulisan "spam removed" jadi komen childrennya tetep muncul. Gimana?

@nsiregar
Copy link
Owner Author

nsiregar commented Jul 2, 2018

hmm boleh juga tuh idenya, ya udah ane benerin dulu

@nsiregar nsiregar merged commit 4ee236f into master Jul 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants