diff options
-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> |