Skip to content

Commit

Permalink
Slice commit messages on build pages (travis-ci#2062)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafael-travis authored Jun 27, 2019
1 parent a4cce59 commit cc23bea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/helpers/format-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ emojiConvertor.allow_native = false;

function formatMessage(message, options) {
message = message || '';

if (options.maxLength) {
message = message.slice(0, options.maxLength);
}

if (options.short) {
message = message.split(/\n/)[0];
}
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/build-header.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<small class="commit-branch"
title={{item.branch.name}}>{{item.branch.name}}</small>
{{/if}}
{{format-message commit.subject repo=item.repo eventType=build.eventType}}
{{format-message commit.subject repo=item.repo eventType=build.eventType maxLength=60}}
{{/if}}
</h2>
<div class="commit-info">
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/builds-item.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</div>
{{else}}
<div class="row-message">
{{{format-message build.commit.message short="true" repo=build.repo eventType=build.eventType}}}
{{{format-message build.commit.message short="true" repo=build.repo eventType=build.eventType maxLength=50}}}
</div>
{{/if}}
</div>
Expand Down

0 comments on commit cc23bea

Please sign in to comment.