DEV: simplify truncation logic (#59)

DEV: simplify truncation logic (#59)

It avoids calling Topic.fancy_title two times, it works because Topic.fancy_title(title) when under limit with mostly return a safe version of title

diff --git a/lib/discourse_code_review/state/commit_topics.rb b/lib/discourse_code_review/state/commit_topics.rb
index 23d4241..b3772b7 100644
--- a/lib/discourse_code_review/state/commit_topics.rb
+++ b/lib/discourse_code_review/state/commit_topics.rb
@@ -94,17 +94,10 @@ module DiscourseCodeReview::State::CommitTopics
 
             tags << SiteSetting.code_review_commit_tag
 
-            truncated_title =
-              if Topic.fancy_title(title).length > Topic.max_fancy_title_length
-                Topic.fancy_title(title).truncate(Topic.max_fancy_title_length)
-              else
-                title
-              end
-
             post = PostCreator.create!(
               user,
               raw: raw,
-              title: truncated_title,
+              title: Topic.fancy_title(title).truncate(Topic.max_fancy_title_length),
               created_at: commit[:date],
               category: category_id,
               tags: tags,

GitHub sha: 6eccbfd6

This commit appears in #59 which was approved by ZogStriP. It was merged by jjaffeux.