dscf-marketplace 0.13.8 → 0.13.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0a4e70c0a7ba7cd2e04c0789cf215631ee94ad124892ab5655bde66037b8a931
|
|
4
|
+
data.tar.gz: e02095b4c24fd10f30e46f8e2f9fff8df0a192d2dfbe32a8f9b81768833b4eb0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7abf3080c4208782460e6ed94a223c4a0730dd6cd2ff27419980a501e7f2729c21699b4c0237ecfe8c85f81962b698aec7b17e73922eac595160238445203458
|
|
7
|
+
data.tar.gz: 96841b42186010cf01261d58d9749f2f253eec051a4e2f1de3cc977bf51b1ae96d423963941f46d921a5446bdaae4c7e4cd52f3953b010faf0adf65418539117
|
|
@@ -137,6 +137,39 @@ module Dscf
|
|
|
137
137
|
render_error(errors: e.message, status: :unprocessable_entity)
|
|
138
138
|
end
|
|
139
139
|
|
|
140
|
+
# Supplier-owner resubmission after an admin modification request.
|
|
141
|
+
# Applies any corrected fields / re-attached documents, then records a
|
|
142
|
+
# fresh :pending review so the record re-enters the admin queue. Only
|
|
143
|
+
# valid from the :modify state (mirrors the reviewable transition
|
|
144
|
+
# "modify" => "pending").
|
|
145
|
+
def resubmit
|
|
146
|
+
set_object
|
|
147
|
+
authorize @obj, :resubmit?
|
|
148
|
+
|
|
149
|
+
unless @obj.modification_requested?(:default)
|
|
150
|
+
return render_error(errors: "Supplier is not awaiting modification", status: :unprocessable_entity)
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
ActiveRecord::Base.transaction do
|
|
154
|
+
@obj.update!(model_params) if params[:supplier].present?
|
|
155
|
+
|
|
156
|
+
@obj.documents.attach(params[:business_license]) if params[:business_license].present?
|
|
157
|
+
|
|
158
|
+
if params[:additional_documents].present?
|
|
159
|
+
params[:additional_documents].each { |doc| @obj.documents.attach(doc) }
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
@obj.resubmit!
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
render_success("suppliers.success.resubmit", data: @obj.reload)
|
|
166
|
+
rescue ActiveRecord::RecordInvalid => e
|
|
167
|
+
errors = e.respond_to?(:record) && e.record ? e.record.errors.full_messages : [e.message]
|
|
168
|
+
render_error(errors: errors, status: :unprocessable_entity)
|
|
169
|
+
rescue StandardError => e
|
|
170
|
+
render_error(errors: e.message, status: :unprocessable_entity)
|
|
171
|
+
end
|
|
172
|
+
|
|
140
173
|
private
|
|
141
174
|
|
|
142
175
|
def create_notification(action_type, reason = nil)
|
|
@@ -73,6 +73,18 @@ module Dscf::Marketplace
|
|
|
73
73
|
)
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
+
# Owner resubmission after a modification request: records a fresh pending
|
|
77
|
+
# review (no reviewer — this is a submission, not an admin review), which
|
|
78
|
+
# moves current_status_for back to "pending" for re-review.
|
|
79
|
+
def resubmit!
|
|
80
|
+
Dscf::Core::Review.create!(
|
|
81
|
+
reviewable: self,
|
|
82
|
+
context: :default,
|
|
83
|
+
status: "pending",
|
|
84
|
+
reviewed_at: Time.current
|
|
85
|
+
)
|
|
86
|
+
end
|
|
87
|
+
|
|
76
88
|
def review_status(context = :default)
|
|
77
89
|
current_status_for(context)
|
|
78
90
|
end
|
data/config/routes.rb
CHANGED