Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

URL handling not working with lita templating functionality #36

Open
dieterdemeyer opened this issue May 18, 2015 · 10 comments
Open

URL handling not working with lita templating functionality #36

dieterdemeyer opened this issue May 18, 2015 · 10 comments

Comments

@dieterdemeyer
Copy link

Hello,

I'm trying out the lita templating functionality using the slack adapter but can't seem to get the URL handling to work.
I'm using the following code in my .erb file:

*GitHub Org Pull Requests:*
<% @github_open_issues.each do |repo_name, issues| %>
<% issues.each do |issue| %>
• <%= repo_name %>: <<%= issue.html_url %>|pull request #<%= issue.number %>> - <%= issue.title %> - by <<%= issue.user.html_url %>|<%= issue.user.login %>>
<% end %>
<% end %>

The output now is:

• puppet-alternatives: <https://github.com/cegeka/puppet-alternatives/pull/1|pull request #1> - fix: insync function comparing current and should items - by <https://github.com/vladnazarenko|vladnazarenko>

But I would like to see the following:

• puppet-alternatives: pull request #1 - fix: insync function comparing current and should items - by vladnazarenko

Any suggestions on what I'm doing wrong ?
I think I'm using the correct syntax for links in Slack but any help would be appreciated..

@jimmycuadra
Copy link
Contributor

lita-slack 1.5 was just released with new logic to remove the special formatting the Slack applies to incoming messages. Try it again with 1.5 and see if it works how you'd expect it to!

@pseudomuto
Copy link

This seems like it's still a problem in 1.5. @dieterdemeyer did you ever find a solution for this?

@freibuis
Copy link
Contributor

@pseudomuto I tried the code example listed and it works ok..

do you have some examples that I can look at?

@pseudomuto
Copy link

For sure. I was trying get github deployment information and render a few links in there. Here's the snippet that wasn't working for me (just renders the supplied text inside < > rather than linking:

*Latest deploys for <%= @repo.full_name %>*
<% @deploys.each do |deploy| %>
> <%= deploy.at %> - *<%= deploy.user %>* <<%= deploy.url %>|deployed> <%= @repo.repo_name %>/<%= @repo.full_name %> (<%= "<#{@repo.url_for_sha(deploy.sha)}|#{@repo.shorten_sha(deploy.sha)}>" %>) to *<%= deploy.environment %>*
<% end %>

@ewr
Copy link

ewr commented Aug 27, 2015

This is an issue with the Slack RTM message handling. See slackhq/slack-api-docs#32.

The workaround is to use the API chat.postMessage endpoint for complex messages.

This lita-slack fork (not mine, but probably one I'll grab to address this issue for the moment) implements that by assuming that non-strings sent to send_messages are complex messages, and pointing them to the API: jaisonerick@fc4138c

That gives you support for attachments, but doesn't make a happy path for inline formatting. For that you would need to do something funkier, like a regex for format-looking bits in the message string.

@dieterdemeyer
Copy link
Author

@pseudomuto I hadn't gotten around to testing this yet due to other stuff..
I'll see if I can test this again in the near future.

@pseudomuto
Copy link

@dieterdemeyer cool...thanks man! In the mean time, I'll monkey patch with@ewr's diff from #49 and see if that resolves it.

@paquettej
Copy link

+1 Any eta on a fix?

@jimmycuadra
Copy link
Contributor

Anyone following this issue may be interested in #68—I think it will address this.

@jimmycuadra
Copy link
Contributor

Update: the PR to follow is now #76.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants