Browse Source

return room list on main page by default

main
ghost 8 months ago
parent
commit
725bfa28cb
  1. 6
      .env
  2. 2
      README.md
  3. 21
      src/Controller/RoomController.php
  4. 2
      templates/default/module/rooms.html.twig

6
.env

@ -19,7 +19,7 @@ APP_ENV=dev
APP_SECRET=EDIT_ME APP_SECRET=EDIT_ME
###< symfony/framework-bundle ### ###< symfony/framework-bundle ###
APP_VERSION=1.12.1 APP_VERSION=1.13.0
APP_NAME=KevaChat APP_NAME=KevaChat
@ -57,13 +57,13 @@ APP_KEVACOIN_MINE_SOLO_URL=https://kevacoin.org/tutorial_solo_mining.html
APP_KEVACOIN_EXPLORER_URL=https://keva.one/explorer/address/ APP_KEVACOIN_EXPLORER_URL=https://keva.one/explorer/address/
# Pinned room namespaces, separated with | # Pinned room namespaces, separated with |
APP_KEVACOIN_ROOM_NAMESPACES_PINNED=EDIT_ME APP_KEVACOIN_ROOM_NAMESPACES_PINNED=
# Allowed room namespaces for read only (e.g. project news) separated with | # Allowed room namespaces for read only (e.g. project news) separated with |
APP_KEVACOIN_ROOM_NAMESPACES_READONLY= APP_KEVACOIN_ROOM_NAMESPACES_READONLY=
# Redirect from index page to default room # Redirect from index page to default room
APP_KEVACOIN_ROOM_NAMESPACE_DEFAULT=EDIT_ME APP_KEVACOIN_ROOM_NAMESPACE_DEFAULT=
# Session expire # Session expire
APP_SESSION_DEFAULT_TIMEOUT=2592000 APP_SESSION_DEFAULT_TIMEOUT=2592000

2
README.md

@ -62,7 +62,7 @@ Application package contain settings preset, just few steps required to launch:
* Send few coins to this address and wait for new block to continue * Send few coins to this address and wait for new block to continue
* To allow users registration, create namespace `kevacoin-cli keva_namespace "_KEVACHAT_USERS_"` * To allow users registration, create namespace `kevacoin-cli keva_namespace "_KEVACHAT_USERS_"`
* Create at least one room namespace with Web UI or CLI `kevacoin-cli keva_namespace "sandbox"` * Create at least one room namespace with Web UI or CLI `kevacoin-cli keva_namespace "sandbox"`
* Provide at least one namespace for default chat room to `env`.`APP_KEVACOIN_ROOM_NAMESPACE_DEFAULT` (for homepage redirects) * Optionally, provide namespace for default chat room at `env`.`APP_KEVACOIN_ROOM_NAMESPACE_DEFAULT` (for homepage redirect)
## Contribution ## Contribution

21
src/Controller/RoomController.php

@ -29,12 +29,21 @@ class RoomController extends AbstractController
?Request $request ?Request $request
): Response ): Response
{ {
return $this->redirectToRoute( // Redirect to default room on defined
'room_namespace', if ($this->getParameter('app.kevacoin.room.namespace.default'))
[ {
'namespace' => $request->get('namespace') ? $request->get('namespace') : $this->getParameter('app.kevacoin.room.namespace.default'), return $this->redirectToRoute(
'_fragment' => 'latest' 'room_namespace',
] [
'namespace' => $request->get('namespace') ? $request->get('namespace') : $this->getParameter('app.kevacoin.room.namespace.default'),
'_fragment' => 'latest'
]
);
}
// Return room list by default
return $this->list(
$request
); );
} }

2
templates/default/module/rooms.html.twig

@ -23,7 +23,7 @@
{% endif %} {% endif %}
<h2> <h2>
<i> <i>
{% if 'room_list' == request.get('_route') %} {% if 'room_index' == request.get('_route') || 'room_list' == request.get('_route') %}
{{ 'rooms' | trans }} {{ 'rooms' | trans }}
{% else %} {% else %}
<a href="{{ path('room_list') }}">{{ 'rooms' | trans }}</a> <a href="{{ path('room_list') }}">{{ 'rooms' | trans }}</a>

Loading…
Cancel
Save