Sha256: 2acf9e77fefe5b546cfa3789cb3c089c1517b00a44f5bb5cb4291c8250ad3048

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

module Ruboty
  module Jira
    module Actions
      class Comment < Base
        def call
          return unless valid_user?
          comment
        rescue => e
          message.reply(e.message)
        end

        private

        def comment
          issue = find_issue(message[:issue])
          return message.reply("The issue #{message[:issue]} is not found") if issue.nil?
          comment = issue.comments.build
          comment.save!(
            body: format(message[:comment])
          )
        end

        def format(message)
          <<-"EOF"
Commented by @#{associate_user[:name]}
#{message}
          EOF
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruboty-jira-0.3.0 lib/ruboty/jira/actions/comment.rb