diff options
author | 2017-07-14 08:41:33 -0700 | |
---|---|---|
committer | 2017-07-14 08:42:27 -0700 | |
commit | 74f55f2c72c260ab6791ea478642692c2eb373f0 (patch) | |
tree | 51996651a15c0961942ec94f4cf9968a8f603cc8 | |
parent | Update copyright date - thanks to Thomas (whissi) for the bug report and patc... (diff) | |
download | frontend-74f55f2c72c260ab6791ea478642692c2eb373f0.tar.gz frontend-74f55f2c72c260ab6791ea478642692c2eb373f0.tar.bz2 frontend-74f55f2c72c260ab6791ea478642692c2eb373f0.zip |
Add "Find on Google Groups" per bug #602636.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
-rw-r--r-- | lib/helpers.rb | 9 | ||||
-rw-r--r-- | views/message.erb | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/lib/helpers.rb b/lib/helpers.rb index 8e58417..1e79b12 100644 --- a/lib/helpers.rb +++ b/lib/helpers.rb @@ -2,6 +2,7 @@ require 'rinku' require 'erb' MARC_FIND = 'https://marc.info/?i='.freeze +GOOGLEGROUP_SEARCH = 'https://groups.google.com/forum/#!search/messageid$3A'.freeze helpers do def list_check @@ -85,4 +86,12 @@ helpers do new_msgid = local + ' () ' + host.gsub('.', ' ! ') MARC_FIND + ERB::Util.url_encode(new_msgid) end + + def msgid_to_googlegroup(msgid) + # We have to transform the msg-id first + # "m2nf4d$9uu$1@dont-email.me" + # search is 'messageid:"m2nf4d$9uu$1@dont-email.me"' + # https://groups.google.com/forum/#!search/messageid$3A%22m2nf4d$249uu$241@dont-email.me%22 + GOOGLEGROUP_SEARCH + ERB::Util.url_encode('"' + msgid + '"') + end end diff --git a/views/message.erb b/views/message.erb index f26445d..523bf25 100644 --- a/views/message.erb +++ b/views/message.erb @@ -83,5 +83,6 @@ <a href="/<%= h list %>/report/<%= message['_id'] %>" class="btn btn-danger btn-xs"><span class="fa fa-fw fa-ban"></span> Report Message</a> <div class="btn-group btn-group-xs"> <a href="<%= msgid_to_marc(message['_source']['raw_message_id']) %>" class="btn btn-default"><span class="fa fa-fw fa-share-square"></span>Find on MARC</a> + <a href="<%= msgid_to_googlegroup(message['_source']['raw_message_id']) %>" class="btn btn-default"><span class="fa fa-fw fa-share-square"></span>Find on Google Groups</a> </div> </div> |