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

Update wiki activity items with initial diff implementation

Mir Bhatia0a8eddfbdd11
diff --git a/app/controllers/journals_controller.rb b/app/controllers/journals_controller.rb
index dccb9d4c576..1f94b7a2971 100644
--- a/app/controllers/journals_controller.rb
+++ b/app/controllers/journals_controller.rb
@@ -93,6 +93,7 @@ class JournalsController < ApplicationController
case @journal.journable_type
when 'WorkPackage' then :view_work_packages
when 'Project' then :view_project
+ when 'WikiContent' then :view_wiki_edits
end
do_authorize(permission)
end
@@ -103,7 +104,7 @@ class JournalsController < ApplicationController
# Is this a valid field for diff'ing?
def valid_field?
- field_param == 'description'
+ field_param == 'description' || 'text'
end
def journals_index_title
diff --git a/app/models/activities/wiki_content_activity_provider.rb b/app/models/activities/wiki_content_activity_provider.rb
index 8cd1c127c4a..2bea95a3c3e 100644
--- a/app/models/activities/wiki_content_activity_provider.rb
+++ b/app/models/activities/wiki_content_activity_provider.rb
@@ -50,7 +50,7 @@ class Activities::WikiContentActivityProvider < Activities::BaseActivityProvider
protected
def event_title(event)
- "#{I18n.t(:label_wiki_edit)}: #{event['wiki_title']} (##{event['version']})"
+ "#{I18n.t(:project_module_wiki)} ##{event['version']}: #{event['wiki_title']}"
end
def event_type(_event)
diff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rb
index a0c3de7ce3e..15b3d09b7f4 100644
--- a/app/models/wiki_content.rb
+++ b/app/models/wiki_content.rb
@@ -35,6 +35,8 @@ class WikiContent < ApplicationRecord
acts_as_journalized
+ # register_journal_formatted_fields(:diff, 'text')
+
acts_as_event type: 'wiki-page',
title: Proc.new { |o|
"#{I18n.t(:label_wiki_edit)}: #{o.journal.journable.page.title} (##{o.journal.journable.version})"
diff --git a/spec/features/activities/wiki_activity_spec.rb b/spec/features/activities/wiki_activity_spec.rb
index 733e87e8f02..15170d6443c 100644
--- a/spec/features/activities/wiki_activity_spec.rb
+++ b/spec/features/activities/wiki_activity_spec.rb
@@ -76,12 +76,12 @@ describe 'Wiki activities' do
click_button 'Apply'
expect(page)
- .to have_link('Wiki edit: My page (#1)')
+ .to have_link('Wiki #1: My page')
expect(page)
- .to have_link('Wiki edit: My page (#2)')
+ .to have_link('Wiki #2: My page')
- click_link('Wiki edit: My page (#2)')
+ click_link('Wiki #2: My page')
expect(page)
.to have_current_path(project_wiki_path(project.id, 'my-page', version: 2))