Skip to content

Commit

Permalink
[frontend] Refactor Event::Request#payload_with_diff
Browse files Browse the repository at this point in the history
  • Loading branch information
bgeuken committed Apr 5, 2018
1 parent 32aaa07 commit d0cd921
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/api/app/models/event/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,12 @@ def payload_with_diff

ret = payload
payload['actions'].each do |a|
diff = calculate_diff(a)
diff = calculate_diff(a).try(:lines)
next unless diff
diff = diff.lines
dl = diff.length
if dl > DIFF_LIMIT
diff_length = diff.length
if diff_length > DIFF_LIMIT
diff = diff[0..DIFF_LIMIT]
diff << "[cut #{dl - DIFF_LIMIT} lines to limit mail size]"
diff << "[cut #{diff_length - DIFF_LIMIT} lines to limit mail size]"
end
a['diff'] = diff.join
end
Expand Down

0 comments on commit d0cd921

Please sign in to comment.