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

Feature - deletion of draft #354

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

iambibhas
Copy link
Contributor

Fixes #337.

{% block content %}
<div class="sheet">
<div class="section first">
<h1>Delete this draft job post?</h1>
Copy link
Member

Choose a reason for hiding this comment

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

"Delete this draft?"

@@ -1011,12 +1011,29 @@ def close(domain, hashid, key):
form = Form()
if form.validate_on_submit():
post.close()
post.closed_datetime = datetime.utcnow()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

noticed that this datetime can be set inside close() so moved there.

@iambibhas
Copy link
Contributor Author

@jace made the necessary changes and tested. works good.

@@ -75,7 +75,7 @@ def has_starred_post(user, post):
User.has_starred_post = has_starred_post


class JobPost(BaseMixin, db.Model):
class JobPost(BaseMixin, db.Model):
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is there an extra space here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure how this got here. fixed it.

def delete(hashid, key):
post = JobPost.query.filter_by(hashid=hashid).options(db.load_only('id', 'status')).first_or_404()
if not post:
abort(404)
Copy link
Member

Choose a reason for hiding this comment

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

This is unnecessary because first_or_404() will do it for you.

if not post.admin_is(g.user):
abort(403)
if not post.is_draft():
return redirect(post.url_for(), code=303)
Copy link
Member

Choose a reason for hiding this comment

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

Flash a message that this post must be withdrawn or closed.


def delete(self):
self.status = POSTSTATUS.DELETED
self.closed_datetime = datetime.utcnow()
Copy link
Member

Choose a reason for hiding this comment

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

Use db.func.utcnow() in both cases.

@jace
Copy link
Member

jace commented Feb 21, 2018

@iambibhas where did we leave this one?

@iambibhas
Copy link
Contributor Author

@jace even I don't remember. This one was pending review I think. All the issues were fixed. Can get back to this once once we merge the statemanager one. Some workflow will change in this I guess.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

Feature request - deletion of drafts
4 participants