show locked/unlocked changes on wiki page histories

This commit is contained in:
Talulah
2022-10-03 19:16:48 -03:00
parent 0cfd0ff436
commit 6a71508c3b

View File

@@ -37,6 +37,8 @@ class WikiPageVersion < ApplicationRecord
title: "Renamed",
was_deleted: "Deleted",
was_undeleted: "Undeleted",
was_locked: "Locked",
was_unlocked: "Unlocked",
}
end
@@ -63,6 +65,24 @@ class WikiPageVersion < ApplicationRecord
end
end
def was_locked(type)
other = send(type)
if type == "previous"
is_locked && !other.is_locked
else
!is_locked && other.is_locked
end
end
def was_unlocked(type)
other = send(type)
if type == "previous"
!is_locked && other.is_locked
else
is_locked && !other.is_locked
end
end
def self.available_includes
[:updater, :wiki_page, :tag]
end