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

Link to zendesk tickets from edition notes automatically #296

Merged
merged 3 commits into from Nov 17, 2014
Merged

Conversation

@fofr
Copy link
Contributor

@fofr fofr commented Nov 17, 2014

Notes often refer to zendesk tickets, it’s useful to link these references to the ticket. Link commonly used patterns such as “zen 1234” and “zendesk ticket #1234”.

Notes often refer to zendesk tickets, it’s useful to link these
references to the ticket. Link commonly used patterns such as “zen
1234” and “zendesk ticket #1234”.
@alext
Copy link
Contributor

@alext alext commented Nov 17, 2014

I wonder whether it would be better to require a specific syntax for linking to zendesk (ie zen:1234). I worry that supporting all these variants will only hurt in the long run (that regex is already pretty hairy).

def auto_link_zendesk_tickets(text)
text.gsub(/(?:zen|zendesk|zendesk ticket)(?:\s)?(?:#|\:)?(?:\s)?(\d{4,})/i) do |s|
ticket = $1
"<a href=\"https://govuk.zendesk.com/tickets/#{ticket}\">#{s}</a>"

This comment has been minimized.

@alext

alext Nov 17, 2014
Contributor

Do you need an .html_safe here. Or you could use the link_to helper.

This comment has been minimized.

@fofr

fofr Nov 17, 2014
Author Contributor

I've moved html_safe closer to source, and switched to the link_to helper.

alext added a commit that referenced this pull request Nov 17, 2014
Link to zendesk tickets from edition notes automatically
@alext alext merged commit 6c52463 into master Nov 17, 2014
1 check passed
1 check passed
default "Build #433 succeeded on Jenkins"
Details
@alext alext deleted the zen-ticket-links branch Nov 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.