show warning in subfolders too; fixed specs

pull/5438/head
Markus Kahl 8 years ago
parent ab7a928d00
commit 470bf12826
  1. 9
      app/assets/stylesheets/openproject/_scm.sass
  2. 8
      app/controllers/repositories_controller.rb
  3. 12
      app/views/repositories/_dir_list_content.html.erb
  4. 24
      spec/lib/open_project/scm/adapters/subversion_adapter_spec.rb
  5. 8
      spec_legacy/unit/repository_subversion_spec.rb

@ -229,3 +229,12 @@ tr
&.filename
a
margin-left: $repository-entry-filename-margin-left
tr
&.entry
&.truncation-warning
td
div.notification-box
margin-left: $repository-entry-filename-margin-left
margin-top: 0
margin-bottom: 0

@ -129,8 +129,8 @@ class RepositoriesController < ApplicationController
@repository.update_required_storage
end
limit = Setting.repository_truncate_at
@entries = @repository.entries(@path, @rev, limit: limit)
@limit = Setting.repository_truncate_at
@entries = @repository.entries(@path, @rev, limit: @limit)
@changeset = @repository.find_changeset_by_name(@rev)
if request.xhr?
@ -142,10 +142,6 @@ class RepositoriesController < ApplicationController
elsif @entries.nil? && @repository.invalid?
show_error_not_found
else
if @entries.truncated?
flash[:warning] = I18n.t "repositories.truncated", limit: limit, truncated: @entries.truncated
end
@changesets = @repository.latest_changesets(@path, @rev)
@properties = @repository.properties(@path, @rev)
render action: 'show'

@ -26,6 +26,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
See doc/COPYRIGHT.rdoc for more details.
++#%>
<% if @entries.truncated? %>
<tr class="<%= h params[:parent_id] %> entry file truncation-warning">
<td colspan="7" style="padding-left: <%= 18 * params[:depth].to_i %>px;">
<div class="notification-box -warning">
<div class="notification-box--content">
<%= I18n.t "repositories.truncated", limit: @limit, truncated: @entries.truncated %>
</div>
</div>
</td>
</tr>
<% end %>
<% @entries.each do |entry| %>
<% tr_id = Digest::MD5.hexdigest(entry.path)
depth = params[:depth].to_i %>

@ -187,32 +187,32 @@ describe OpenProject::Scm::Adapters::Subversion do
it 'builds the info object' do
info = adapter.info
expect(info.root_url).to eq(url)
expect(info.lastrev.identifier).to eq('13')
expect(info.lastrev.author).to eq('oliver')
expect(info.lastrev.time).to eq('2016-04-14T19:23:01.74469Z')
expect(info.lastrev.identifier).to eq('14')
expect(info.lastrev.author).to eq('mkahl')
expect(info.lastrev.time.strftime("%FT%T%:z")).to eq('2017-05-04T14:26:53+01:00')
end
end
describe '.entries' do
it 'reads all entries from the current revision' do
entries = adapter.entries
expect(entries.length).to eq(2)
expect(entries.length).to eq(10)
expect(entries[0].name).to eq('Föbar')
expect(entries[0].path).to eq('Föbar')
expect(entries[1].name).to eq('subversion_test')
expect(entries[1].path).to eq('subversion_test')
expect(entries[1].name).to eq('folder_a')
expect(entries[1].path).to eq('folder_a')
end
it 'contains a reference to the last revision' do
entries = adapter.entries
expect(entries.length).to eq(2)
expect(entries.length).to eq(10)
lastrev = entries[0].lastrev
expect(lastrev.identifier).to eq('13')
expect(lastrev.author).to eq('oliver')
expect(lastrev.message).to eq('')
expect(lastrev.time).to eq('2016-04-14T19:23:01.74469Z')
expect(lastrev.time.strftime("%FT%T%:z")).to eq('2016-04-14T20:23:01+01:00')
end
it 'reads all entries from the given revision' do
@ -284,13 +284,13 @@ describe OpenProject::Scm::Adapters::Subversion do
describe '.revisions' do
it 'returns all revisions by default' do
revisions = adapter.revisions
expect(revisions.length).to eq(13)
expect(revisions.length).to eq(14)
expect(revisions[0].author).to eq('oliver')
expect(revisions[0].message).to eq("UTF-8 Test")
expect(revisions[0].author).to eq('mkahl')
expect(revisions[0].message.strip).to eq("added some more files to work with")
revisions.each_with_index do |rev, i|
expect(rev.identifier).to eq((13 - i).to_s)
expect(rev.identifier).to eq((14 - i).to_s)
end
end

@ -45,8 +45,8 @@ describe Repository::Subversion, type: :model do
@repository.fetch_changesets
@repository.reload
assert_equal 13, @repository.changesets.count
assert_equal 25, @repository.file_changes.count
assert_equal 14, @repository.changesets.count
assert_equal 34, @repository.file_changes.count
assert_equal 'Initial import.', @repository.changesets.find_by(revision: '1').comments
end
@ -58,7 +58,7 @@ describe Repository::Subversion, type: :model do
assert_equal 5, @repository.changesets.count
@repository.fetch_changesets
assert_equal 13, @repository.changesets.count
assert_equal 14, @repository.changesets.count
end
it 'should latest changesets' do
@ -198,7 +198,7 @@ describe Repository::Subversion, type: :model do
it 'should next nil' do
@repository.fetch_changesets
@repository.reload
changeset = @repository.find_changeset_by_name('13')
changeset = @repository.find_changeset_by_name('14')
assert_nil changeset.next
end

Loading…
Cancel
Save