WebEditor: Check if save is possible
This commit is contained in:
parent
e53b47b447
commit
0b3e9fd218
2 changed files with 7 additions and 6 deletions
|
@ -1,15 +1,17 @@
|
|||
module Gitlab
|
||||
class FileEditor
|
||||
|
||||
attr_accessor :user, :project
|
||||
attr_accessor :user, :project, :ref
|
||||
|
||||
def initialize(user, project)
|
||||
def initialize(user, project, ref)
|
||||
self.user = user
|
||||
self.project = project
|
||||
self.ref = ref
|
||||
end
|
||||
|
||||
def can_edit?(path, last_commit)
|
||||
true
|
||||
current_last_commit = @project.commits(ref, path, 1).first.sha
|
||||
last_commit == current_last_commit
|
||||
end
|
||||
|
||||
def update(path, content)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue