Permalink
Browse files

clean_body! method added to remove body text wrapper returned by Octokit

  • Loading branch information...
1 parent 608fecd commit 6caf06a5ae552bed976b6ef042fad3acc88fbf99 @orodriguez orodriguez committed with cored Apr 26, 2012
Showing with 9 additions and 2 deletions.
  1. +9 −2 lib/provider/comment.rb
View
@@ -16,14 +16,13 @@ def initialize(*object)
:body => object.body,
:created_at => object.created_at,
:author => object.user.login}
-
else
hash = object
end
super hash
end
end
-
+
def author
self.user.login
end
@@ -53,6 +52,7 @@ def self.find_by_attributes(project_id, ticket_id, attributes = {})
def self.find_all(project_id, ticket_id)
TicketMaster::Provider::Github.api.issue_comments(project_id, ticket_id).collect do |comment|
comment.merge!(:project_id => project_id, :ticket_id => ticket_id)
+ clean_body! comment
self.new comment
end
end
@@ -62,6 +62,13 @@ def self.create(project_id, ticket_id, comment)
github_comment.merge!(:project_id => project_id, :ticket_id => ticket_id)
self.new github_comment
end
+
+ private
+
+ # See https://www.kanbanpad.com/projects/31edb8d134e7967c1f0d#!xt-4f994f2101428900070759fd
+ def self.clean_body!(comment)
+ comment.body = comment.body.sub(/\A---\s\sbody:\s/, '').gsub(/\s\z/, '')
+ end
end
end

0 comments on commit 6caf06a

Please sign in to comment.