소스 검색

Merge branch 'nathan' into 'master'

Nathan

See merge request clement.krebs/twyrael!12
SPAETER NATHAN 4 년 전
부모
커밋
48fe93ed3f

+ 1 - 0
src/Controller/DisconnectController.php

@@ -11,6 +11,7 @@ class DisconnectController extends AbstractController
     #[Route('/disconnect', name: 'disconnect')]
     public function index(): Response
     {
+        // Suppression de la session.
         $session = $this->get('session');
         $session->clear();
         return $this->render('disconnect/index.html.twig', []);

+ 1 - 0
src/Controller/HashtagController.php

@@ -9,6 +9,7 @@ use Symfony\Component\Routing\Annotation\Route;
 
 class HashtagController extends AbstractController
 {
+    // Fonction de tri.
     private function cmp_array($a, $b): int {
         if ($a == $b) {
             return 0;

+ 8 - 8
src/Controller/HomeController.php

@@ -6,6 +6,7 @@ use App\Entity\Hashtag;
 use App\Entity\Message;
 use App\Entity\Retweets;
 use App\Entity\User;
+use App\Form\MessageType;
 use Doctrine\DBAL\Types\TextType;
 use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
 use Symfony\Component\HttpFoundation\Request;
@@ -30,13 +31,11 @@ class HomeController extends AbstractController
         $session = $this->get('session');
 
         if (null === $session->get('user')) {
-            return  $this->redirectToRoute('home');
+            return  $this->redirectToRoute('login');
         }
 
-        $formBuilder = $this->createFormBuilder();
-        $formBuilder->add('text', \Symfony\Component\Form\Extension\Core\Type\TextType::class,['label' => 'Envoyer un message'])
-            ->setAction($this->generateUrl('home'));
-        $form = $formBuilder->getForm();
+        $options = array("action" => $this->generateUrl('home'));
+        $form = $this->createForm(MessageType::class, null, $options);
 
         if ($request->getMethod() == 'POST') {
             $form->handleRequest($request);
@@ -51,7 +50,7 @@ class HomeController extends AbstractController
                 $hashtags = array();
                 preg_match_all("~@([a-zA-Z0-9_]*)~", $text, $mentions);
                 preg_match_all("~#([a-zA-Z0-9_]*)~", $text, $hashtags);
-                for($i=0; $i < sizeof($mentions[0]); $i++) {
+                for ($i = 0; $i < sizeof($mentions[0]); $i++) {
                     $user = $repository_profile->findOneBy(array('username' => $mentions[1][$i]));
                     if ($user) {
                         $message->addMention($user);
@@ -63,7 +62,7 @@ class HomeController extends AbstractController
                     }
                 }
                 $repository_hashtag = $em->getRepository(Hashtag::class);
-                for($i=0; $i < sizeof($hashtags[0]); $i++) {
+                for ($i = 0; $i < sizeof($hashtags[0]); $i++) {
                     $hashtag = $repository_hashtag->findOneBy(array('name' => $hashtags[1][$i]));
                     if (!$hashtag) {
                         $hashtag = new Hashtag();
@@ -125,7 +124,8 @@ class HomeController extends AbstractController
     }
 
     #[Route('/rt/{msgId}', name: 'rt_message')]
-    public function retweet($msgId) {
+    public function retweet($msgId)
+    {
         $session = $this->get('session');
 
         if (null === $session->get('user')) {

+ 102 - 0
src/Controller/MessageController.php

@@ -0,0 +1,102 @@
+<?php
+
+namespace App\Controller;
+
+use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
+use Symfony\Component\HttpFoundation\Response;
+use Symfony\Component\Routing\Annotation\Route;
+use App\Entity\Hashtag;
+use App\Entity\Message;
+use App\Entity\Retweets;
+use App\Entity\User;
+use App\Form\MessageType;
+use Doctrine\DBAL\Types\TextType;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Session\Session;
+use Symfony\Component\Validator\Constraints\Date;
+
+class MessageController extends AbstractController
+{
+    private function cmp_array($a, $b): int
+    {
+        if ($a->getDate() == $b->getDate()) {
+            return 0;
+        }
+        return ($a->getDate() > $b->getDate()) ? -1 : 1;
+    }
+
+    #[Route('/message/{msgId}', name: 'message')]
+    public function index(Request $request,$msgId): Response
+    {
+        $session = $this->get('session');
+        $em = $this->getDoctrine()->getManager();
+        $repository_message = $em->getRepository(Message::class);
+
+        if (null === $session->get('user')) {
+            return  $this->redirectToRoute('login');
+        }
+
+        $options = array("action" => $this->generateUrl('message', array('msgId' => $msgId)));
+        $form = $this->createForm(MessageType::class, null, $options);
+
+        if ($request->getMethod() == 'POST') {
+            $form->handleRequest($request);
+            if ($form->isValid()) {
+                $session = $this->get('session');
+                $em = $this->getDoctrine()->getManager();
+                $repository_profile = $em->getRepository(User::class);
+                $profile = $repository_profile->findOneBy(array('username' => $session->get('user')));
+                $message = new Message();
+                $text = $form->get('text')->getData();
+                $mentions = array();
+                $hashtags = array();
+                preg_match_all("~@([a-zA-Z0-9_]*)~", $text, $mentions);
+                preg_match_all("~#([a-zA-Z0-9_]*)~", $text, $hashtags);
+                for ($i = 0; $i < sizeof($mentions[0]); $i++) {
+                    $user = $repository_profile->findOneBy(array('username' => $mentions[1][$i]));
+                    if ($user) {
+                        $message->addMention($user);
+                        $mentions[1][$i] = "<a href='/profile/" . $mentions[1][$i] . "'>" . $mentions[0][$i] . "</a>";
+                        $mentions[0][$i] = "~" . $mentions[0][$i] . "~";
+                    } else {
+                        unset($mentions[1][$i]);
+                        unset($mentions[0][$i]);
+                    }
+                }
+                $repository_hashtag = $em->getRepository(Hashtag::class);
+                for ($i = 0; $i < sizeof($hashtags[0]); $i++) {
+                    $hashtag = $repository_hashtag->findOneBy(array('name' => $hashtags[1][$i]));
+                    if (!$hashtag) {
+                        $hashtag = new Hashtag();
+                        $hashtag->setName($hashtags[1][$i]);
+                    }
+                    $hashtag->addMessage($message);
+                    $hashtags[1][$i] = "<a href='/hashtag/" . $hashtags[1][$i] . "'>" . $hashtags[0][$i] . "</a>";
+                    $hashtags[0][$i] = "~" . $hashtags[0][$i] . "~";
+                    $em->persist($hashtag);
+                }
+                $text = preg_replace($mentions[0], $mentions[1], $text);
+                $message->setText(preg_replace($hashtags[0], $hashtags[1], $text));
+                $message->setSender($profile);
+                $message->setMessage($repository_message->find($msgId));
+                $message->setDate(new \DateTime("now"));
+                $em->persist($message);
+                $em->flush();
+            }
+        }
+
+        $message = $repository_message->find($msgId);
+
+        $parent = $message->getMessage();
+
+        $replies = $message->getReplies();
+
+        return $this->render('message/index.html.twig', [
+            'username' => $session->get('user'),
+            'msg' => $message,
+            'replies' => $replies,
+            'parent' => $parent,
+            'form' => $form->createView(),
+        ]);
+    }
+}

+ 4 - 1
src/Controller/ParametersController.php

@@ -20,6 +20,9 @@ class ParametersController extends AbstractController
     {
         // Connexion à la BDD et récuperation de l'utilisateur
         $sessionUser = $this->get('session')->get('user');
+        if (null === $sessionUser) {
+            return  $this->redirectToRoute('login');
+        }
         $em = $this->getDoctrine()->getManager();
         $repository_profile = $em->getRepository(User::class);
         $sessionUser = $this->get('session')->get('user');
@@ -46,7 +49,7 @@ class ParametersController extends AbstractController
 
         // Génération du formulaire
         $form = $formBuilder->getForm();
-        
+
         // Initialisation du message
         $message = "";
 

+ 2 - 2
src/Controller/PrivateDiscussionController.php

@@ -18,11 +18,11 @@ class PrivateDiscussionController extends AbstractController
         $session = $this->get('session');
 
         if (null === $session->get('user')) {
-            return  $this->redirectToRoute('home');
+            return  $this->redirectToRoute('login');
         }
 
         $formBuilder = $this->createFormBuilder();
-        $formBuilder->add('text', \Symfony\Component\Form\Extension\Core\Type\TextType::class)
+        $formBuilder->add('text', \Symfony\Component\Form\Extension\Core\Type\TextType::class,['label' => 'Envoyer un message'])
             ->setAction($this->generateUrl('private_discussion', ['id' => $id]));
         $form = $formBuilder->getForm();
 

+ 23 - 6
src/Controller/PrivateDiscussionsController.php

@@ -15,19 +15,22 @@ class PrivateDiscussionsController extends AbstractController
     #[Route('/private/discussions', name: 'private_discussions')]
     public function index(Request $request): Response
     {
+        $error = "";
         $session = $this->get('session');
 
         if (null === $session->get('user')) {
-            return  $this->redirectToRoute('home');
+            return  $this->redirectToRoute('login');
         }
         $formBuilder = $this->createFormBuilder();
-        $formBuilder->add('text', \Symfony\Component\Form\Extension\Core\Type\TextType::class)
-            ->add('username', \Symfony\Component\Form\Extension\Core\Type\TextType::class)
+        $formBuilder->add('text', \Symfony\Component\Form\Extension\Core\Type\TextType::class, ['label' => 'Envoyer un message'])
+            ->add('username', \Symfony\Component\Form\Extension\Core\Type\TextType::class, ['label' => 'Utilisateur'])
             ->setAction($this->generateUrl('private_discussions'));
         $form = $formBuilder->getForm();
 
         $em = $this->getDoctrine()->getManager();
         $repo_user = $em->getRepository(User::class);
+        $user = $repo_user->findOneBy(array('username' => $session->get("user")));
+
         $user = $repo_user->findOneBy(array('username' => $session->get("user")));
         $private_discussions = array();
         foreach ($user->getPrivateDiscussions() as $pd) {
@@ -45,17 +48,29 @@ class PrivateDiscussionsController extends AbstractController
             if ($form->isValid()) {
                 $recept = $repo_user->findOneBy(array('username' => $form->get('username')->getData()));
                 if (!$recept) {
-                    return new Response("Profil non existant");
+                    return $this->render('private_discussions/index.html.twig', [
+                        'controller_name' => 'PrivateDiscussionsController',
+                        'form' => $form->createView(),
+                        'private_discussions' => $private_discussions,
+                        'username' => $session->get('user'),
+                        'error' => "Profil non existant.",
+                    ]);
                 }
                 $disc_found = false;
                 foreach ($user->getPrivateDiscussions() as $disc) {
-                    if(in_array($recept, $disc->getParticipants()->getValues())) {
+                    if (in_array($recept, $disc->getParticipants()->getValues())) {
                         $disc_found = true;
                         break;
                     }
                 }
                 if ($disc_found) {
-                    return new Response("Discussion existante");
+                    return $this->render('private_discussions/index.html.twig', [
+                        'controller_name' => 'PrivateDiscussionsController',
+                        'form' => $form->createView(),
+                        'private_discussions' => $private_discussions,
+                        'username' => $session->get('user'),
+                        'error' => "Discussion existante.",
+                    ]);
                 }
                 $discussion = new PrivateDiscussion();
                 $discussion->addParticipant($user);
@@ -67,6 +82,7 @@ class PrivateDiscussionsController extends AbstractController
                 $em->persist($dm);
                 $em->persist($discussion);
                 $em->flush();
+                return  $this->redirectToRoute('private_discussions');
             }
         }
 
@@ -75,6 +91,7 @@ class PrivateDiscussionsController extends AbstractController
             'form' => $form->createView(),
             'private_discussions' => $private_discussions,
             'username' => $session->get('user'),
+            'error' => "",
         ]);
     }
 }

+ 3 - 0
src/Controller/ProfileController.php

@@ -24,6 +24,9 @@ class ProfileController extends AbstractController
     {
         // Vérifie si le profil est celui de l'utilisateur connecté.
         $sessionUser = $this->get('session')->get('user');
+        if (null === $sessionUser) {
+            return  $this->redirectToRoute('login');
+        }
         $me = $sessionUser == $username ? true : false;
 
         // Connexion à la table User

+ 6 - 0
src/Controller/ProfileManagerController.php

@@ -13,6 +13,9 @@ class ProfileManagerController extends AbstractController
     public function follow($username): Response
     {
         $session = $this->get('session');
+        if (null === $session->get('user')) {
+            return  $this->redirectToRoute('login');
+        }
         $em = $this->getDoctrine()->getManager();
         $repository_profile = $em->getRepository(User::class);
         $profile = $repository_profile->findOneBy(array('username' => $session->get('user')));
@@ -29,6 +32,9 @@ class ProfileManagerController extends AbstractController
     public function unfollow($username): Response
     {
         $session = $this->get('session');
+        if (null === $session->get('user')) {
+            return  $this->redirectToRoute('login');
+        }
         $em = $this->getDoctrine()->getManager();
         $repository_profile = $em->getRepository(User::class);
         $profile = $repository_profile->findOneBy(array('username' => $session->get('user')));

+ 5 - 4
src/Controller/ResearchController.php

@@ -13,14 +13,15 @@ class ResearchController extends AbstractController
     #[Route('/research', name: 'research')]
     public function index(Request $request): Response
     {
+        $session = $this->get('session');
+        if (null === $session->get('user')) {
+            return  $this->redirectToRoute('login');
+        }
         $em = $this->getDoctrine()->getManager();
         $repository_message = $em->getRepository(Message::class);
         $messages = $repository_message->findMessageContainString($request->query->get('s'));
-        // foreach ($messages as $message) {
-        //     array_push($sub_msg, $msg);
-        // }
         return $this->render('research/index.html.twig', [
-            'username' => $this->get('session')->get('user'),
+            'username' => $session->get('user'),
             'messages' => $messages,
         ]);
     }

+ 53 - 0
src/Entity/Message.php

@@ -45,10 +45,21 @@ class Message
      */
     private $retweets;
 
+    /**
+     * @ORM\ManyToOne(targetEntity=Message::class, inversedBy="replies")
+     */
+    private $message;
+
+    /**
+     * @ORM\OneToMany(targetEntity=Message::class, mappedBy="message")
+     */
+    private $replies;
+
     public function __construct()
     {
         $this->mentions = new ArrayCollection();
         $this->retweets = new ArrayCollection();
+        $this->replies = new ArrayCollection();
     }
 
     public function getId(): ?int
@@ -149,4 +160,46 @@ class Message
 
         return $this;
     }
+
+    public function getMessage(): ?self
+    {
+        return $this->message;
+    }
+
+    public function setMessage(?self $message): self
+    {
+        $this->message = $message;
+
+        return $this;
+    }
+
+    /**
+     * @return Collection|self[]
+     */
+    public function getReplies(): Collection
+    {
+        return $this->replies;
+    }
+
+    public function addReply(self $reply): self
+    {
+        if (!$this->replies->contains($reply)) {
+            $this->replies[] = $reply;
+            $reply->setMessage($this);
+        }
+
+        return $this;
+    }
+
+    public function removeReply(self $reply): self
+    {
+        if ($this->replies->removeElement($reply)) {
+            // set the owning side to null (unless already changed)
+            if ($reply->getMessage() === $this) {
+                $reply->setMessage(null);
+            }
+        }
+
+        return $this;
+    }
 }

+ 24 - 0
src/Form/MessageType.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace App\Form;
+
+use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\FormBuilderInterface;
+use Symfony\Component\OptionsResolver\OptionsResolver;
+use Symfony\Component\Form\Extension\Core\Type\TextType;
+
+class MessageType extends AbstractType
+{
+    public function buildForm(FormBuilderInterface $builder, array $options)
+    {
+        $builder
+            ->add('text', TextType::class, ['label' => 'Envoyer un message']);
+    }
+
+    public function configureOptions(OptionsResolver $resolver)
+    {
+        $resolver->setDefaults([
+            // Configure your form options here
+        ]);
+    }
+}

+ 6 - 4
templates/base.html.twig

@@ -24,7 +24,10 @@
 					<ul class="navbar-nav me-auto mb-2 mb-lg-0">
 						{% if username is defined and username is not null %}
 							<li class="nav-item">
-								<a class="nav-link" href="{{ path('home') }}">Accueil</a>
+								<a class="nav-link" href="{{ path('home') }}">Flux</a>
+							</li>
+							<li class="nav-item">
+								<a class="nav-link" href="{{ path('private_discussions') }}">MP</a>
 							</li>
 							<li class="nav-item">
 								<a class="nav-link" href="{{ path('profile', {'username': username }) }}">Profil</a>
@@ -50,7 +53,6 @@
 					</ul>
 				</div>
 			</div>
-		</nav>
-		{% block body %}{% endblock %}
+		</body>
 	</body>
-</html></body></html>
+</html></nav>{% block body %}{% endblock %}</body></html></body></html>

+ 2 - 1
templates/hashtag/index.html.twig

@@ -1,6 +1,7 @@
 {% extends 'base.html.twig' %}
 
-{% block title %}Hello HashtagController!
+{% block title %}
+	Hashtag
 {% endblock %}
 
 {% block body %}

+ 1 - 0
templates/home/index.html.twig

@@ -20,6 +20,7 @@
 					</h5>
 					<h6 class="card-subtitle mb-2 text-muted">{{ msg.getDate()|date('H:i - d/m/Y') }}</h6>
 					<p class="card-text">{{ msg.text | striptags('<a>') | raw }}</p>
+					<a href="{{ path('message', {'msgId': msg.getId() }) }}" class="card-link">Répondre</a>
 					<a href="{{ path('rt_message', {'msgId': msg.getId() }) }}" class="card-link">RT</a>
 				</div>
 			</div>

+ 10 - 3
templates/index/index.html.twig

@@ -1,7 +1,14 @@
 {% extends 'base.html.twig' %}
 
-{% block title %}Accueil{% endblock %}
+{% block title %}Accueil
+{% endblock %}
 
 {% block body %}
-<h1>Bienvenue sur Twyrael.</h1>
-{% endblock %}
+	<div class="d-flex flex-column align-items-center">
+		<div class="card" style="width: 75rem;">
+			<div class="card-body">
+				<h5 class="card-title">Bienvenue sur Twyrael.</h5>
+			</div>
+		</div>
+	</div>
+{% endblock %}

+ 48 - 0
templates/message/index.html.twig

@@ -0,0 +1,48 @@
+{% extends 'base.html.twig' %}
+
+{% block title %}
+	Message
+{% endblock %}
+
+{% block body %}
+	<div class="d-flex flex-column align-items-center">
+		{% if parent %}
+			<div class="card" style="width: 75rem;">
+				<h5 class="card-title">
+					<a href="{{ path('message', {'msgId': parent.getId() }) }}">Afficher le message parent</a>
+				</h5>
+			</div>
+		{% endif %}
+		<div class="card" style="width: 75rem;">
+			<div class="card-body">
+				<h5 class="card-title">
+					<a href={{ path('profile', {'username': msg.sender.getUsername() } ) }}>{{ msg.sender.getUsername() }}</a>
+				</h5>
+				<h6 class="card-subtitle mb-2 text-muted">{{ msg.getDate()|date('H:i - d/m/Y') }}</h6>
+				<p class="card-text">{{ msg.text | striptags('<a>') | raw }}</p>
+				<a href="{{ path('message', {'msgId': msg.getId() }) }}" class="card-link">Répondre</a>
+				<a href="{{ path('rt_message', {'msgId': msg.getId() }) }}" class="card-link">RT</a>
+			</div>
+		</div>
+		<div class="card" style="width: 50rem;">
+			{{ form_start(form) }}
+			{{ form_errors(form) }}
+			{{ form_widget(form) }}
+			<button type="submit" class="btn btn-primary">Envoyer</button>
+			{{ form_end(form) }}
+		</div>
+		{% for msg in replies %}
+			<div class="card" style="width: 50rem;">
+				<div class="card-body">
+					<h5 class="card-title">
+						<a href={{ path('profile', {'username': msg.sender.getUsername() } ) }}>{{ msg.sender.getUsername() }}</a>
+					</h5>
+					<h6 class="card-subtitle mb-2 text-muted">{{ msg.getDate()|date('H:i - d/m/Y') }}</h6>
+					<p class="card-text">{{ msg.text | striptags('<a>') | raw }}</p>
+					<a href="{{ path('message', {'msgId': msg.getId() }) }}" class="card-link">Répondre</a>
+					<a href="{{ path('rt_message', {'msgId': msg.getId() }) }}" class="card-link">RT</a>
+				</div>
+			</div>
+		{% endfor %}
+	</div>
+{% endblock %}

+ 14 - 8
templates/parameters/index.html.twig

@@ -4,12 +4,18 @@
 {% endblock %}
 
 {% block body %}
-	{{ form_start(form) }}
-	{{ form_errors(form) }}
-	{{ form_widget(form) }}
-	<button type="submit" class="btn btn-primary">Envoyer</button>
-	{% if message %}
-		<div>{{ message }}</div>
-	{% endif %}
-	{{ form_end(form) }}
+	<div class="d-flex flex-column align-items-center">
+		<div class="card" style="width: 75rem;">
+			<div class="card-body">
+				{{ form_start(form) }}
+				{{ form_errors(form) }}
+				{{ form_widget(form) }}
+				<button type="submit" class="btn btn-primary">Envoyer</button>
+				{% if message %}
+					<div>{{ message }}</div>
+				{% endif %}
+				{{ form_end(form) }}
+			</div>
+		</div>
+	</div>
 {% endblock %}

+ 22 - 13
templates/private_discussion/index.html.twig

@@ -1,18 +1,27 @@
 {% extends 'base.html.twig' %}
 
-{% block title %}Hello PrivateDiscussionController!{% endblock %}
+{% block title %}
+	Discussion
+{% endblock %}
 
 {% block body %}
-    <ul>
-    {% for msg in messages %}
-        <li>
-            <div>{{ msg.sender.getUsername() }}</div>
-            <div>{{ msg.text }}</div>
-        </li>
-    {% endfor %}
-    </ul>
-    {{ form_start(form) }}
-    {{ form_errors(form) }}
-    {{ form_widget(form) }} <input type="submit">
-    {{ form_end(form) }}
+	<div class="d-flex flex-column align-items-center">
+		<div class="card" style="width: 75rem;">
+			{% for msg in messages %}
+				<div class="card" style="width: 75rem;">
+					<div class="card-body">
+						<h5 class="card-title">{{ msg.sender.getUsername() }}</h5>
+						<p class="card-text">{{ msg.text | striptags('<a>') | raw }}</p>
+					</div>
+				</div>
+			{% endfor %}
+			<div class="card" style="width: 75rem;">
+				{{ form_start(form) }}
+				{{ form_errors(form) }}
+				{{ form_widget(form) }}
+				<button type="submit" class="btn btn-primary">Envoyer</button>
+				{{ form_end(form) }}
+			</div>
+		</div>
+	</div>
 {% endblock %}

+ 35 - 17
templates/private_discussions/index.html.twig

@@ -1,21 +1,39 @@
 {% extends 'base.html.twig' %}
 
-{% block title %}Hello PrivateDiscussionsController!{% endblock %}
+{% block title %}
+	Discussions
+{% endblock %}
 
 {% block body %}
-    {{ form_start(form) }}
-    {{ form_errors(form) }}
-    {{ form_widget(form) }} <input type="submit">
-    {{ form_end(form) }}
-    <ul>
-    {% for pd in private_discussions %}
-        {% for key, value in pd %}
-            <li>
-                <div>
-                <a href={{ path('private_discussion', {'id': key }) }}>Discussion privée avec </a><a href={{ path('profile', {'username': value }) }}>@{{ value }}</a>
-                </div>
-            </li>
-        {% endfor %}
-    {% endfor %}
-    </ul>
-{% endblock %}
+	<ul></ul>
+	<div class="d-flex flex-column align-items-center">
+		{% if error %}
+			<div class="card" style="width: 75rem;">
+				<div class="card-body">
+					<p class="card-text">{{ error }}</p>
+				</div>
+			</div>
+		{% endif %}
+		<div class="card" style="width: 75rem;">
+			<div class="card-body">
+				{{ form_start(form) }}
+				{{ form_errors(form) }}
+				{{ form_widget(form) }}
+				<input type="submit">
+				{{ form_end(form) }}
+			</div>
+		</div>
+		<div class="card" style="width: 75rem;">
+			<div class="card-body">
+				{% for pd in private_discussions %}
+					{% for key, value in pd %}
+						<p class="card-text">
+							<a href={{ path('private_discussion', {'id': key } ) }}>Discussion privée avec</a>
+							<a href={{ path('profile', {'username': value } ) }}>@{{ value }}</a>
+						</p>
+					{% endfor %}
+				{% endfor %}
+			</div>
+		</div>
+	</div>
+</div>{% endblock %}