Commit 05439a76 authored by Douwe Maan's avatar Douwe Maan
Browse files

Force creation of new import_state when setting an import state field

parent 772f2a5b6f66
......@@ -647,8 +647,8 @@
}
end
def ensure_import_state
return if self[:import_status] == 'none' || self[:import_status].nil?
def ensure_import_state(force: false)
return if !force && (self[:import_status] == 'none' || self[:import_status].nil?)
return unless import_state.nil?
create_import_state(import_state_args)
......@@ -657,5 +657,5 @@
end
def import_schedule
ensure_import_state
ensure_import_state(force: true)
......@@ -661,5 +661,5 @@
import_state&.schedule
import_state.schedule
end
def force_import_start
......@@ -663,5 +663,5 @@
end
def force_import_start
ensure_import_state
ensure_import_state(force: true)
......@@ -667,5 +667,5 @@
import_state&.force_start
import_state.force_start
end
def import_start
......@@ -669,5 +669,5 @@
end
def import_start
ensure_import_state
ensure_import_state(force: true)
......@@ -673,5 +673,5 @@
import_state&.start
import_state.start
end
def import_fail
......@@ -675,5 +675,5 @@
end
def import_fail
ensure_import_state
ensure_import_state(force: true)
......@@ -679,5 +679,5 @@
import_state&.fail_op
import_state.fail_op
end
def import_finish
......@@ -681,5 +681,5 @@
end
def import_finish
ensure_import_state
ensure_import_state(force: true)
......@@ -685,5 +685,5 @@
import_state&.finish
import_state.finish
end
def import_jid=(new_jid)
......@@ -687,5 +687,5 @@
end
def import_jid=(new_jid)
ensure_import_state
ensure_import_state(force: true)
......@@ -691,5 +691,5 @@
import_state&.jid = new_jid
import_state.jid = new_jid
end
def import_jid
......@@ -699,5 +699,5 @@
end
def import_error=(new_error)
ensure_import_state
ensure_import_state(force: true)
......@@ -703,5 +703,5 @@
import_state&.last_error = new_error
import_state.last_error = new_error
end
def import_error
......@@ -711,5 +711,5 @@
end
def import_status=(new_status)
ensure_import_state
ensure_import_state(force: true)
......@@ -715,5 +715,5 @@
import_state&.status = new_status
import_state.status = new_status
end
def import_status
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment