Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Memorekall Member New
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rekall
Memorekall Member New
Commits
278c6b16
Commit
278c6b16
authored
3 years ago
by
Camille Simiand
Browse files
Options
Downloads
Patches
Plain Diff
User shouldn't be able to edit video url if project doesnt exist
parent
70cc606e
No related branches found
No related tags found
1 merge request
!48
tuleap-133-change-the-video-url-of-a-capsule
Pipeline
#774
passed
3 years ago
Stage: test
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/Controller/ProjectController.php
+30
-9
30 additions, 9 deletions
src/Controller/ProjectController.php
translations/messages.en.yaml
+1
-1
1 addition, 1 deletion
translations/messages.en.yaml
translations/messages.fr.yaml
+1
-1
1 addition, 1 deletion
translations/messages.fr.yaml
with
32 additions
and
11 deletions
src/Controller/ProjectController.php
+
30
−
9
View file @
278c6b16
...
...
@@ -22,12 +22,18 @@ use ZipArchive;
class
ProjectController
extends
AbstractController
{
private
TranslatorInterface
$translator
;
public
function
__construct
(
TranslatorInterface
$translator
)
{
$this
->
translator
=
$translator
;
}
/**
* @Route("/project/create", name="create_project", methods={"POST"})
* @throws ZipArchiveNotOpeningException
*/
public
function
create
(
TranslatorInterface
$translator
,
Capsule
$capsule
,
string
$video_url
):
Response
{
...
...
@@ -39,7 +45,7 @@ class ProjectController extends AbstractController
if
(
file_exists
(
$capsule_directory
))
{
$this
->
addFlash
(
'warning'
,
$translator
->
trans
(
$
this
->
translator
->
trans
(
'project.already_exists'
,
[
'capsule_name'
=>
$capsule_name
...
...
@@ -58,7 +64,7 @@ class ProjectController extends AbstractController
$this
->
addFlash
(
'success'
,
$translator
->
trans
(
$
this
->
translator
->
trans
(
'capsule.created_success'
,
[
'capsule_name'
=>
$capsule_name
...
...
@@ -74,7 +80,6 @@ class ProjectController extends AbstractController
* @throws ZipArchiveNotOpeningException
*/
public
function
duplicate
(
TranslatorInterface
$translator
,
Capsule
$capsule
,
string
$parent_directory
,
Filesystem
$file_system
...
...
@@ -87,7 +92,7 @@ class ProjectController extends AbstractController
if
(
file_exists
(
$capsule_directory
))
{
$this
->
addFlash
(
'warning'
,
$translator
->
trans
(
$
this
->
translator
->
trans
(
'project.already_exists'
,
[
'capsule_name'
=>
$capsule_name
...
...
@@ -104,7 +109,7 @@ class ProjectController extends AbstractController
$this
->
addFlash
(
'success'
,
$translator
->
trans
(
$
this
->
translator
->
trans
(
'capsule.duplicate.success'
,
[
'capsule_name'
=>
$capsule_name
...
...
@@ -175,7 +180,6 @@ class ProjectController extends AbstractController
public
function
editVideoUrl
(
int
$capsule_id
,
Request
$request
,
TranslatorInterface
$translator
,
CapsuleRepository
$capsule_repository
):
Response
{
$capsule
=
$capsule_repository
->
findOneBy
([
'id'
=>
$capsule_id
]);
...
...
@@ -183,6 +187,24 @@ class ProjectController extends AbstractController
throw
new
\Exception
(
'The retrieved capsule is not an instance of Capsule.'
);
}
$file_system
=
new
Filesystem
();
$parent_directory_name
=
$capsule
->
getLinkPath
();
$parent_directory_exists
=
$file_system
->
exists
(
'../legacy/'
.
$parent_directory_name
);
if
(
!
$parent_directory_exists
)
{
$this
->
addFlash
(
'warning'
,
$this
->
translator
->
trans
(
'project.not_exist'
,
[
'capsule_name'
=>
$capsule
->
getName
()
]
)
);
return
$this
->
redirectToRoute
(
'capsule_list'
);
}
$form
=
$this
->
createForm
(
EditVideoUrlFormType
::
class
);
$form
->
handleRequest
(
$request
);
...
...
@@ -192,11 +214,10 @@ class ProjectController extends AbstractController
chdir
(
'../legacy/'
);
$this
->
setVideoUrlNodeAttributeInXMLProjectFile
(
$project_directory
,
$new_video_url
);
// $this->rescheduleProjectAnnotations($project_XML_file_path);
$this
->
addFlash
(
'success'
,
$translator
->
trans
(
$
this
->
translator
->
trans
(
'capsule.edit.video_url.success'
)
);
...
...
This diff is collapsed.
Click to expand it.
translations/messages.en.yaml
+
1
−
1
View file @
278c6b16
...
...
@@ -93,7 +93,7 @@ capsule:
project
:
already_exists
:
Project capsule_name already exists so the capsule could not be created
not_exist
:
The project
to duplicate
does not exist
not_exist
:
The project does not exist
preview
:
loading
:
Project loading
...
...
This diff is collapsed.
Click to expand it.
translations/messages.fr.yaml
+
1
−
1
View file @
278c6b16
...
...
@@ -91,7 +91,7 @@ capsule:
project
:
already_exists
:
Le projet capsule_name existe déjà. La capsule n'a pas pu être créée
not_exist
:
Le projet
a dupliquer
n'existe pas
not_exist
:
Le projet n'existe pas
preview
:
loading
:
Projet en cours de chargement
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment