diff options
Diffstat (limited to 'app/models')
| -rw-r--r-- | app/models/locked_by_another_user.rb | 1 | ||||
| -rw-r--r-- | app/models/node.rb | 13 |
2 files changed, 9 insertions, 5 deletions
diff --git a/app/models/locked_by_another_user.rb b/app/models/locked_by_another_user.rb new file mode 100644 index 0000000..6f9e272 --- /dev/null +++ b/app/models/locked_by_another_user.rb | |||
| @@ -0,0 +1 @@ | |||
| class LockedByAnotherUser < StandardError; end | |||
diff --git a/app/models/node.rb b/app/models/node.rb index f7a70d0..41c3867 100644 --- a/app/models/node.rb +++ b/app/models/node.rb | |||
| @@ -73,7 +73,7 @@ class Node < ApplicationRecord | |||
| 73 | raise( | 73 | raise( |
| 74 | LockedByAnotherUser, | 74 | LockedByAnotherUser, |
| 75 | "Page is locked by another user who is working on it! " \ | 75 | "Page is locked by another user who is working on it! " \ |
| 76 | "Last modification: #{draft.updated_at.to_s(:db)}" | 76 | "Last modification: #{draft.updated_at.to_fs(:db)}" |
| 77 | ) | 77 | ) |
| 78 | else | 78 | else |
| 79 | lock_for! current_user | 79 | lock_for! current_user |
| @@ -211,6 +211,13 @@ class Node < ApplicationRecord | |||
| 211 | self.created_at < new_id_format_date ? unique_path : id | 211 | self.created_at < new_id_format_date ? unique_path : id |
| 212 | end | 212 | end |
| 213 | 213 | ||
| 214 | # TODO: restore full-text search once PostgreSQL is upgraded. | ||
| 215 | # The tsvector/plpgsql approach requires PostgreSQL 10+ with plpgsql available. | ||
| 216 | # For now, search is disabled to unblock the Rails 7.2 upgrade. | ||
| 217 | def self.search(term, _ = {}) | ||
| 218 | none | ||
| 219 | end | ||
| 220 | |||
| 214 | protected | 221 | protected |
| 215 | def lock_for! current_user | 222 | def lock_for! current_user |
| 216 | self.lock_owner = current_user | 223 | self.lock_owner = current_user |
| @@ -255,7 +262,3 @@ class Node < ApplicationRecord | |||
| 255 | end | 262 | end |
| 256 | end | 263 | end |
| 257 | end | 264 | end |
| 258 | |||
| 259 | class LockedByAnotherUser < StandardError; end | ||
| 260 | |||
| 261 | |||
