<commit_before>require 'asakusa_satellite/hook'

class AsakusaSatellite::Hook::RedmineTicketLink < AsakusaSatellite::Hook::Listener
  def message_buttons(context)
    subject     = URI.escape(context[:message].body)
    description = URI.escape(<<"END")
#{context[:message].user.name}: #{context[:message].body}

#{context[:permlink]}
END

    path = nil
    context[:self].instance_eval { path = image_path("redmine.png") }
    info = context[:message].room.yaml[:redmine_ticket]
    root         = info["root"]
    project_name = info["project_name"]
    url =  URI.join(root,
                    "./projects/#{project_name}/issues/new?issue[description]=#{description}&issue[subject]=#{subject}")
    %(<a target="_blank" href="#{url}"><img src="#{path}" /></a>)
  rescue => e
    p e
    ""
  end
end<commit_msg>デバッグ用の出力が残っていたので消した refs #959<commit_after>require 'asakusa_satellite/hook'

class AsakusaSatellite::Hook::RedmineTicketLink < AsakusaSatellite::Hook::Listener
  def message_buttons(context)
    subject     = URI.escape(context[:message].body)
    description = URI.escape(<<"END")
#{context[:message].user.name}: #{context[:message].body}

#{context[:permlink]}
END

    path = nil
    context[:self].instance_eval { path = image_path("redmine.png") }
    info = context[:message].room.yaml[:redmine_ticket]
    root         = info["root"]
    project_name = info["project_name"]
    url =  URI.join(root,
                    "./projects/#{project_name}/issues/new?issue[description]=#{description}&issue[subject]=#{subject}")
    %(<a target="_blank" href="#{url}"><img src="#{path}" /></a>)
  rescue => e
    ""
  end
end
{'fraction_non_alphanumeric': 0.17865853658536585, 'fraction_numerical': 0.001829268292682927, 'mean_word_length': 4.276527331189711, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3867687', 'n_tokens_mistral': 549, 'n_tokens_neox': 536, 'n_words': 79}