mirror of
https://github.com/kevachat/webapp.git
synced 2025-01-22 20:44:59 +00:00
implement post quotes
This commit is contained in:
parent
7e0d0e2b7d
commit
3a500a1554
@ -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()
|
||||
]
|
||||
|
@ -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:
|
||||
[
|
||||
|
@ -1,4 +1,4 @@
|
||||
<form name="room" action="{{ path('room_index') }}" method="get">
|
||||
<form name="room" action="{{ path('room_namespace', { namespace : room.namespace }) }}" method="get">
|
||||
<input type="text" name="namespace" value="{{ room.namespace }}" placeholder="{{ 'join room by kevacoin namespace...' | trans }}" />
|
||||
</form>
|
||||
{% if list %}
|
||||
@ -6,10 +6,10 @@
|
||||
{% for namespace, name in list %}
|
||||
{% if i %}•{% endif %}
|
||||
<h2>
|
||||
{% if room.namespace == namespace %}
|
||||
{% if namespace == room.namespace %}
|
||||
{{ name }}
|
||||
{% else %}
|
||||
<a href="{{ namespace }}">{{ name }}</a>
|
||||
<a href="{{ path('room_namespace', { namespace : namespace }) }}">{{ name }}</a>
|
||||
{% endif %}
|
||||
</h2>
|
||||
{% set i = i + 1 %}
|
||||
|
@ -23,9 +23,10 @@
|
||||
@{{ 'anonymous' | trans }}
|
||||
</strong>
|
||||
{% endif %}
|
||||
<a href="#{{ post.txid }}" title="{{ 'time:' | trans }} {{ post.transaction.time }} / {{ 'confirmations:' | trans }} {{ post.transaction.confirmations }}">
|
||||
{{ post.transaction.timestamp | format_ago }}
|
||||
</a>
|
||||
•
|
||||
<a href="#{{ post.txid }}" title="{{ 'time:' | trans }} {{ post.transaction.time }} / {{ 'confirmations:' | trans }} {{ post.transaction.confirmations }}">{{ post.transaction.timestamp | format_ago }}</a>
|
||||
•
|
||||
<a href="{{ path('room_namespace', { namespace : request.get('namespace'), txid : post.txid }) }}#{{ post.txid }}">{{ 'quote' | trans }}</a>
|
||||
<p>
|
||||
{{ post.value }}
|
||||
</p>
|
||||
|
Loading…
x
Reference in New Issue
Block a user