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/Exclude Drafts from News Feed [PLAT-690] #934

Conversation

pattisdr
Copy link
Contributor

@pattisdr pattisdr commented Sep 4, 2018

Purpose

News articles drafts show up in news feed

Changes

Update query to fetch NewsArticles where live=True.

Before

Test draft shows up
screen shot 2018-09-04 at 11 31 24 am

After

Only "live" articles displayed in feed
screen shot 2018-09-04 at 11 31 45 am

Ticket

https://openscience.atlassian.net/browse/PLAT-690

@@ -577,7 +577,7 @@ def serve(self, request):
self.template = page_template
return render(request, self.template, {
'page': self,
'newsArticles': NewsArticle.objects.all().order_by('-date'),
'newsArticles': NewsArticle.objects.filter(live=True).order_by('-date'),
Copy link
Contributor Author

@pattisdr pattisdr Sep 4, 2018

Choose a reason for hiding this comment

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

This took me awhile to find...spent some time looking at templates/page/news.html.. I was sure that I needed to just do something like: news_item.live is True. Since this was doing nothing, I spent awhile convinced that my changes just weren't showing up locally. Then I skimmed wagtail docs thinking this must be a setting somewhere. I searched through wagtail bugs sure this must be an issue on their end. I finally found this by just going through the models.

Should we add a ticket to audit which code is unused in this codebase and either delete or mark as obsolete? I wasted a lot of time just trying to find this file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh wow, good catch.

I don't think it's worth doing a full audit of the codebase at this time; for now, I think we can just clean litter up as we find it (Boy Scout Rule).

Btw, I've removed the unused template.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great, thanks

@sloria sloria merged commit ad6b734 into CenterForOpenScience:develop Sep 5, 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