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

Only link to non broken links on First Mark page #162

Closed
wants to merge 4 commits into from

Conversation

struan
Copy link
Member

@struan struan commented Jun 11, 2024

Uses the list of link status codes provided by CEUK to generate a list of bad links and then uses that to only turn good URLs into links in the previous responses part of the first mark page.

Fixes #146

@struan struan force-pushed the 142-link-q-across-sessions branch from 332489f to 2f60c0b Compare June 12, 2024 10:56
@struan struan force-pushed the 146-highlight-broken-links branch from 1fe3938 to 8f3b960 Compare June 12, 2024 11:03
@struan struan requested a review from zarino June 13, 2024 16:15
Copy link
Member

@zarino zarino left a comment

Choose a reason for hiding this comment

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

Code looks good, although I’ve not tried it end-to-end locally.

I wonder whether just printing out the broken URL will make it obvious enough that the link is actually broken? Should we include "[dead link]" after it?

I’d also be tempted to make dead links look more prominent too. The aim of #146 (although I realise I didn’t document this at the time) was to warn markers when a link has died, because that might mean the evidence that got a council a mark in the previous year no longer exists. Giving the link (or <span> if you still want it to just be plain text) a class="text-danger" attribute might help.

@struan struan requested a review from zarino June 17, 2024 13:33
Copy link
Member

@zarino zarino left a comment

Choose a reason for hiding this comment

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

One typo! Aside from that, looks good.

@stringfilter
def check_if_broken(text, autoescape=True):
if check_if_url_bad(text):
return mark_safe(f'<span class="text-danger">{text}</a>')
Copy link
Member

Choose a reason for hiding this comment

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

Should be </span> not </a>

@struan struan force-pushed the 142-link-q-across-sessions branch 2 times, most recently from d14f9a6 to 434809f Compare June 19, 2024 11:02
@struan struan force-pushed the 146-highlight-broken-links branch from ae1df09 to 723ac35 Compare June 19, 2024 11:03
@struan
Copy link
Member Author

struan commented Jun 19, 2024

Merges in 723ac35

@struan struan closed this Jun 19, 2024
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