diff --git a/src/Controller/ModuleController.php b/src/Controller/ModuleController.php index 3369861..992d52e 100644 --- a/src/Controller/ModuleController.php +++ b/src/Controller/ModuleController.php @@ -120,12 +120,43 @@ class ModuleController extends AbstractController } } + // Format quoted message + if (preg_match('/^[A-z0-9]{64}$/', $request->get('txid'))) + { + $message = str_replace( + [ + sprintf( + '@%s', + $request->get('txid') + ) + ], + false, + $request->get('message') + ); + + $message = trim( + $message + ); + + $message = sprintf( + '@%s%s%s', + $request->get('txid'), + PHP_EOL, + $request->get('message') + ); + } + + else + { + $message = $request->get('message'); + } + return $this->render( 'default/module/post.html.twig', [ 'enabled' => in_array($request->get('namespace'), $public), 'namespace' => $request->get('namespace'), - 'message' => $request->get('message'), + 'message' => $message, 'user' => $request->get('user'), 'ip' => $request->getClientIp() ] diff --git a/src/Controller/RoomController.php b/src/Controller/RoomController.php index c62e830..5ddb020 100644 --- a/src/Controller/RoomController.php +++ b/src/Controller/RoomController.php @@ -29,11 +29,16 @@ class RoomController extends AbstractController } #[Route( - '/room/{namespace}', + '/room/{namespace}/{txid}', name: 'room_namespace', requirements: [ 'namespace' => '^[A-z0-9]{34}$', + 'txid' => '^[A-z0-9]{64}$', + ], + defaults: + [ + 'txid' => null, ], methods: [ diff --git a/templates/default/module/room.html.twig b/templates/default/module/room.html.twig index 825d6b6..9c6d9b1 100644 --- a/templates/default/module/room.html.twig +++ b/templates/default/module/room.html.twig @@ -1,4 +1,4 @@ -
+
{% if list %} @@ -6,10 +6,10 @@ {% for namespace, name in list %} {% if i %}•{% endif %}

- {% if room.namespace == namespace %} + {% if namespace == room.namespace %} {{ name }} {% else %} - {{ name }} + {{ name }} {% endif %}

{% set i = i + 1 %} diff --git a/templates/default/room/index.html.twig b/templates/default/room/index.html.twig index 7c00497..dc46468 100644 --- a/templates/default/room/index.html.twig +++ b/templates/default/room/index.html.twig @@ -23,9 +23,10 @@ @{{ 'anonymous' | trans }} {% endif %} - - {{ post.transaction.timestamp | format_ago }} - + • + {{ post.transaction.timestamp | format_ago }} + • + {{ 'quote' | trans }}

{{ post.value }}