indicateur des messages non lus en gras (fixes #7)
This commit is contained in:
parent
6d89671acf
commit
04c061b7f6
@ -478,7 +478,7 @@ class PageController extends Controller
|
||||
}
|
||||
|
||||
// On marque tt les messages comme lu par l'utilisateur
|
||||
|
||||
/* Se fait à présent sur le controleur message au moment meme où l'on affiche l'ensemble des messages
|
||||
if($usage=="group") {
|
||||
// On calcule le nombre de message non lu pour le groupe
|
||||
$group=$em->getRepository("CadolesCoreBundle:Group")->find($groupid);
|
||||
@ -513,6 +513,7 @@ class PageController extends Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
// Type Calendrier
|
||||
|
@ -57,6 +57,16 @@ class ChatController extends Controller
|
||||
|
||||
// Récupération des message du groupe
|
||||
$messages=$em->getRepository("CadolesWebsocketBundle:Message")->findBy(["group"=>$group],["submitdate"=>"DESC"],100);
|
||||
foreach($messages as $message) {
|
||||
$haveread = ($message->getReaders()->contains($user));
|
||||
$message->setHaveread($haveread);
|
||||
|
||||
if(!$haveread) {
|
||||
$message->addReader($this->getUser());
|
||||
$em->persist($message);
|
||||
$em->flush();
|
||||
}
|
||||
}
|
||||
|
||||
// Création du formulaire
|
||||
$form = $this->createForm(ChatType::class,null,[]);
|
||||
|
@ -58,6 +58,18 @@ class Message
|
||||
*/
|
||||
protected $sees;
|
||||
|
||||
|
||||
/* champs calculé non stocké en base */
|
||||
private $haveread;
|
||||
public function getHaveread()
|
||||
{
|
||||
return $this->haveread;
|
||||
}
|
||||
public function setHaveread($haveread) {
|
||||
$this->haveread = $haveread;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -23,6 +23,10 @@
|
||||
background-color: #{{ colorbodyback }};
|
||||
color: #{{ colorbodyfont }};
|
||||
}
|
||||
.message-toread {
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
.msgavatar {
|
||||
float:left;
|
||||
height:40px;
|
||||
@ -65,7 +69,11 @@
|
||||
|
||||
<div class="mychat">
|
||||
{% for message in messages %}
|
||||
<div id='message-{{message.id}}' class='message row'>
|
||||
{% set classread="" %}
|
||||
{% if not message.haveread %}
|
||||
{% set classread="message-toread" %}
|
||||
{% endif %}
|
||||
<div id='message-{{message.id}}' class='message row {{classread}}'>
|
||||
<div class='msgavatar'>
|
||||
<img style='cursor:pointer' onclick='seeUser({{message.user.id}})' id='user_avatar_img' src='/{{ alias }}/uploads/avatar/{{message.user.avatar}}' class='avatar'><br>
|
||||
{% if fgmanager or message.user == app.user %}
|
||||
@ -278,7 +286,7 @@
|
||||
isdeco=false;
|
||||
|
||||
if(payload.msg) {
|
||||
html ="<div id='message-"+payload.msg.id+"' class='message row'>";
|
||||
html ="<div id='message-"+payload.msg.id+"' class='message row message-toread'>";
|
||||
html+="<div class='msgavatar'>";
|
||||
html+="<img style='pointer:cursor' onclick='seeUser("+payload.msg.userid+")' id='user_avatar_img' src='/{{ alias }}/uploads/avatar/"+payload.msg.avatar+"' class='avatar'><br>";
|
||||
if(payload.msg.userid=={{app.user.id}} || '{{ fgmanager }}'=='1') {
|
||||
|
Loading…
Reference in New Issue
Block a user