diff --git a/backend/app/controllers/wiki_pages_controller.rb b/backend/app/controllers/wiki_pages_controller.rb index fb465a3..c4dedf0 100644 --- a/backend/app/controllers/wiki_pages_controller.rb +++ b/backend/app/controllers/wiki_pages_controller.rb @@ -49,7 +49,7 @@ class WikiPagesController < ApplicationController case change.action when ?= { type: 'context', content: change.old_element } - when ?| + when ?! [{ type: 'removed', content: change.old_element }, { type: 'added', content: change.new_element }] when ?+ @@ -98,13 +98,18 @@ class WikiPagesController < ApplicationController return head :unprocessable_entity if title.blank? || body.blank? page = WikiPage.find(params[:id]) + base_revision_id = page.current_revision.id if params[:title].present? && params[:title].strip != page.title return head :unprocessable_entity end message = params[:message].presence - Wiki::Commit.content!(page:, body:, created_user: current_user, message:) + Wiki::Commit.content!(page:, + body:, + created_user: current_user, + message:, + base_revision_id:) head :ok end diff --git a/frontend/src/pages/wiki/WikiDiffPage.tsx b/frontend/src/pages/wiki/WikiDiffPage.tsx index 85a62f0..e99033b 100644 --- a/frontend/src/pages/wiki/WikiDiffPage.tsx +++ b/frontend/src/pages/wiki/WikiDiffPage.tsx @@ -40,10 +40,10 @@ export default () => { {diff ? ( diff.diff.map (d => ( - - {d.content == '\n' ?
: d.content} -
))) +

+ {d.content} +

))) : 'Loading...'} )