diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2017-10-05 18:07:13 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-10-05 18:07:13 +0800 |
commit | cf19299e58df78060ae6ff774e8e6b31a8da1d43 (patch) | |
tree | e11aa2122533fe44a81cbe25ecb7c4374f0522eb | |
parent | de22e153e6eede54d4dcbe53295a4f9a8be638de (diff) | |
download | gitlab-ce-show-stale-branches.tar.gz |
Fix wordings and always make is_merged accurate.show-stale-branches
At first I want to tweak the wordings so that people would
be aware that it might be stale rather than not merged yet.
But that also involved translations...
After some second thought, we would only try to calculate this if:
* `can?(current_user, :push_code, @project)`
* `protected_branch?(@project, branch)`
* `can?(current_user, :delete_protected_branch, @project)`
And this might already reduce the calculation for quite a lot.
We could revisit the performance later, if this is still slow.
Better get it right than trying to be fast without knowing if
it's an issue.
-rw-r--r-- | app/views/projects/branches/_branch.html.haml | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/app/views/projects/branches/_branch.html.haml b/app/views/projects/branches/_branch.html.haml index 9ab5d2d6699..2d169fa36ed 100644 --- a/app/views/projects/branches/_branch.html.haml +++ b/app/views/projects/branches/_branch.html.haml @@ -14,7 +14,7 @@ - if branch.name == @repository.root_ref %span.label.label-primary default - elsif branch_stale?(branch, from: default_branch_commit_date) - %span.label.label-warning.has-tooltip{ title: s_('Branches|Not updated since %{date}') % { date: time_ago_in_words(branch.dereferenced_target.committed_date) } } + %span.label.label-warning.has-tooltip{ title: s_('Branches|Not updated for %{date}') % { date: time_ago_in_words(branch.dereferenced_target.committed_date) } } = s_('Branches|stale') - elsif @repository.merged_to_root_ref? branch.name %span.label.label-info.has-tooltip{ title: s_('Branches|Merged into %{default_branch}') % { default_branch: @repository.root_ref } } @@ -51,7 +51,7 @@ target: "#modal-delete-branch", delete_path: project_branch_path(@project, branch.name), branch_name: branch.name, - is_merged: ("true" if !branch_stale?(branch, from: default_branch_commit_date) && @repository.merged_to_root_ref?(branch.name)) } } + is_merged: ("true" if @repository.merged_to_root_ref?(branch.name)) } } = icon("trash-o") - else %button{ class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip disabled", |