Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

removes wiki#date_index which is not linked in the UI

ulferts80d22e98fa8c
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb
index 202171d3c0f..ae1a089af2d 100644
--- a/app/controllers/wiki_controller.rb
+++ b/app/controllers/wiki_controller.rb
@@ -79,16 +79,10 @@ class WikiController < ApplicationController
slug = wiki_page_title.nil? ? 'wiki' : WikiPage.slug(wiki_page_title)
@related_page = WikiPage.find_by(wiki_id: @wiki.id, slug: slug)
- load_pages_for_index
+ @pages = @wiki.pages.order(Arel.sql('title')).includes(wiki: :project)
@pages_by_parent_id = @pages.group_by(&:parent_id)
end
- # List of page, by last update
- def date_index
- load_pages_for_index
- @pages_by_date = @pages.group_by { |p| p.updated_at.to_date }
- end
-
def new; end
def new_child
@@ -423,10 +417,6 @@ class WikiController < ApplicationController
page.editable_by?(User.current)
end
- def load_pages_for_index
- @pages = @wiki.pages.with_updated_at.order(Arel.sql('title')).includes(wiki: :project)
- end
-
def default_breadcrumb
Wiki.name.humanize
end
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb
index ab485ef10e2..856bfdb8e7e 100644
--- a/app/models/wiki_page.rb
+++ b/app/models/wiki_page.rb
@@ -69,12 +69,6 @@ class WikiPage < ApplicationRecord
before_save :update_redirects
before_destroy :remove_redirects
- # eager load information about last updates, without loading text
- scope :with_updated_at, -> {
- select("#{WikiPage.table_name}.*, #{WikiContent.table_name}.updated_at")
- .joins("LEFT JOIN #{WikiContent.table_name} ON #{WikiContent.table_name}.page_id = #{WikiPage.table_name}.id")
- }
-
scope :main_pages, ->(wiki_id) {
where(wiki_id: wiki_id, parent_id: nil)
}
diff --git a/app/views/wiki/date_index.html.erb b/app/views/wiki/date_index.html.erb
deleted file mode 100644
index 88e4d39caf5..00000000000
--- a/app/views/wiki/date_index.html.erb
+++ /dev/null
@@ -1,55 +0,0 @@
-<%#-- copyright
-OpenProject is an open source project management software.
-Copyright (C) 2012-2022 the OpenProject GmbH
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License version 3.
-
-OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-Copyright (C) 2006-2013 Jean-Philippe Lang
-Copyright (C) 2010-2013 the ChiliProject Team
-
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-See COPYRIGHT and LICENSE files for more details.
-
-++#%>
-
-<%= toolbar title: t(:label_index_by_date) do %>
- <li class="toolbar-item">
- <%= watcher_link(@wiki, User.current) %>
- </li>
-<% end %>
-
-<% if @pages.empty? %>
- <%= no_results_box %>
-<% end %>
-<% @pages_by_date.keys.sort.reverse.each do |date| %>
- <h3><%= format_date(date) %></h3>
- <ul>
- <% @pages_by_date[date].each do |page| %>
- <li><%= link_to page.title, project_wiki_path(page.project, page) %></li>
- <% end %>
- </ul>
-<% end %>
-<% if @pages.any? %>
- <%= other_formats_links do |f| %>
- <%= f.link_to 'Atom', url: {controller: '/activities', action: 'index', show_wiki_edits: 1, key: User.current.rss_key} %>
- <%= f.link_to('HTML', url: {action: 'export'}) if User.current.allowed_to?(:export_wiki_pages, @project) %>
- <% end %>
-<% end %>
-<% content_for :header_tags do %>
- <%= auto_discovery_link_tag(:atom, controller: '/activities', action: 'index', id: @project, show_wiki_edits: 1, format: 'atom', key: User.current.rss_key) %>
-<% end %>
diff --git a/config/initializers/permissions.rb b/config/initializers/permissions.rb
index 1f8a4b208c1..bbe625af095 100644
--- a/config/initializers/permissions.rb
+++ b/config/initializers/permissions.rb
@@ -259,7 +259,7 @@ Rails.application.reloader.to_prepare do
map.project_module :wiki do |wiki|
wiki.permission :view_wiki_pages,
- { wiki: %i[index show special date_index] }
+ { wiki: %i[index show special] }
wiki.permission :list_attachments,
{ wiki: :list_attachments },
diff --git a/config/routes.rb b/config/routes.rb
index 6377b188ff7..dee08a838f3 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -228,7 +228,6 @@ OpenProject::Application.routes.draw do
collection do
post '/new' => 'wiki#create', as: 'create'
get :export
- get :date_index
get '/index' => 'wiki#index'
end
diff --git a/spec/routing/wiki_routing_spec.rb b/spec/routing/wiki_routing_spec.rb
index 8e837a35db6..a10455e2ba4 100644
--- a/spec/routing/wiki_routing_spec.rb
+++ b/spec/routing/wiki_routing_spec.rb
@@ -166,12 +166,6 @@ describe WikiController, type: :routing do
project_id: '567')
}
- it {
- is_expected.to route(:get, '/projects/567/wiki/date_index').to(controller: 'wiki',
- action: 'date_index',
- project_id: '567')
- }
-
it {
is_expected.to route(:get, '/projects/567/wiki/export').to(controller: 'wiki',
action: 'export',
diff --git a/spec_legacy/functional/wiki_controller_spec.rb b/spec_legacy/functional/wiki_controller_spec.rb
index 3a494bf41af..71743af5234 100644
--- a/spec_legacy/functional/wiki_controller_spec.rb
+++ b/spec_legacy/functional/wiki_controller_spec.rb
@@ -225,7 +225,6 @@ describe WikiController, type: :controller do
pages = assigns(:pages)
refute_nil pages
assert_equal wiki.pages.size, pages.size
- assert_equal pages.first.content.updated_at, pages.first.updated_at
assert_select 'ul', attributes: { class: 'pages-hierarchy' },
child: { tag: 'li', child: { tag: 'a', attributes: { href: '/projects/ecookbook/wiki/CookBook%20documentation' },
@@ -270,21 +269,6 @@ describe WikiController, type: :controller do
end
end
- context 'GET :date_index' do
- before do
- get :date_index, params: { project_id: 'ecookbook' }
- end
-
- it { is_expected.to respond_with :success }
- it { should_assign_to :pages }
- it { should_assign_to :pages_by_date }
- it { is_expected.to render_template 'wiki/date_index' }
-
- it 'should include atom link' do
- assert_select 'a', attributes: { href: '/projects/ecookbook/activity.atom?show_wiki_edits=1' }
- end
- end
-
it 'should not found' do
get :show, params: { project_id: 999 }
assert_response 404
diff --git a/spec_legacy/unit/wiki_page_spec.rb b/spec_legacy/unit/wiki_page_spec.rb
index 1c9bb9a7cf7..41d40859c82 100644
--- a/spec_legacy/unit/wiki_page_spec.rb
+++ b/spec_legacy/unit/wiki_page_spec.rb
@@ -111,11 +111,4 @@ describe WikiPage, type: :model do
assert_nil child.parent_id
end
end
-
- it 'should updated on eager load' do
- page = WikiPage.with_updated_at.first
- assert page.is_a?(WikiPage)
- refute_nil page.read_attribute(:updated_at)
- assert_equal page.content.updated_at, page.updated_at
- end
end