empty flag dossier name fix
This commit is contained in:
@@ -109,7 +109,17 @@ class MaterioFlagController extends ControllerBase {
|
|||||||
public function createUserFlaggingCollection(Request $request) {
|
public function createUserFlaggingCollection(Request $request) {
|
||||||
// dpm($request);
|
// dpm($request);
|
||||||
$post_data = json_decode( $request->getContent(),TRUE);
|
$post_data = json_decode( $request->getContent(),TRUE);
|
||||||
$name = $post_data['name'];
|
$name = is_array($post_data) && is_string($post_data['name'] ?? NULL) ? trim($post_data['name']) : '';
|
||||||
|
|
||||||
|
// A nameless collection creates a related flag with a NULL label, which
|
||||||
|
// makes token info building throw a TypeError and thus breaks every
|
||||||
|
// token consumer, including recurring order closing (Stripe payments).
|
||||||
|
if ($name === '') {
|
||||||
|
return new JsonResponse([
|
||||||
|
'status' => FALSE,
|
||||||
|
'error' => 'A folder name is required.',
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
$newFlagColl = FlaggingCollection::Create([
|
$newFlagColl = FlaggingCollection::Create([
|
||||||
'type' => 'flagging_collection_type',
|
'type' => 'flagging_collection_type',
|
||||||
|
|||||||
+3
-3
File diff suppressed because one or more lines are too long
Binary file not shown.
+1
-1
File diff suppressed because one or more lines are too long
Binary file not shown.
+3
-3
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
BIN
Binary file not shown.
-1
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
+2
-2
File diff suppressed because one or more lines are too long
BIN
Binary file not shown.
+1
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
+3
-3
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
Vendored
BIN
Binary file not shown.
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
BIN
Binary file not shown.
@@ -143,6 +143,11 @@ export default {
|
|||||||
}),
|
}),
|
||||||
onCreateFlagColl () {
|
onCreateFlagColl () {
|
||||||
console.log("Card onCreateFlagColl", this.new_folder_name)
|
console.log("Card onCreateFlagColl", this.new_folder_name)
|
||||||
|
// same rule as the add button's "active" state: never create a nameless
|
||||||
|
// folder (a null flag label breaks token info, hence recurring payments)
|
||||||
|
if (this.new_folder_name.trim().length <= 4 || this.is_creating_folder) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.is_creating_folder = true;
|
this.is_creating_folder = true;
|
||||||
this.createFlagColl(this.new_folder_name)
|
this.createFlagColl(this.new_folder_name)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
@@ -157,6 +162,9 @@ export default {
|
|||||||
this.loadingFlag = false;
|
this.loadingFlag = false;
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.is_creating_folder = false;
|
||||||
|
})
|
||||||
},
|
},
|
||||||
flagIsActive(collid) {
|
flagIsActive(collid) {
|
||||||
// console.log("Card flagIsActive",
|
// console.log("Card flagIsActive",
|
||||||
|
|||||||
@@ -446,6 +446,11 @@ export default {
|
|||||||
},
|
},
|
||||||
onCreateFlagColl () {
|
onCreateFlagColl () {
|
||||||
console.log("Card onCreateFlagColl", this.new_folder_name)
|
console.log("Card onCreateFlagColl", this.new_folder_name)
|
||||||
|
// same rule as the add button's "active" state: never create a nameless
|
||||||
|
// folder (a null flag label breaks token info, hence recurring payments)
|
||||||
|
if (this.new_folder_name.trim().length <= 4 || this.is_creating_folder) {
|
||||||
|
return
|
||||||
|
}
|
||||||
this.is_creating_folder = true;
|
this.is_creating_folder = true;
|
||||||
this.createFlagColl(this.new_folder_name)
|
this.createFlagColl(this.new_folder_name)
|
||||||
.then(data => {
|
.then(data => {
|
||||||
@@ -460,6 +465,9 @@ export default {
|
|||||||
this.loadingFlag = false;
|
this.loadingFlag = false;
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.is_creating_folder = false;
|
||||||
|
})
|
||||||
},
|
},
|
||||||
flagIsActive(collid) {
|
flagIsActive(collid) {
|
||||||
// console.log(this.item.uuid)
|
// console.log(this.item.uuid)
|
||||||
|
|||||||
Reference in New Issue
Block a user