Browse Source

return room list on main page by default

main
ghost 6 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 @@ -19,7 +19,7 @@ APP_ENV=dev
APP_SECRET=EDIT_ME
###< symfony/framework-bundle ###
APP_VERSION=1.12.1
APP_VERSION=1.13.0
APP_NAME=KevaChat
@ -57,13 +57,13 @@ APP_KEVACOIN_MINE_SOLO_URL=https://kevacoin.org/tutorial_solo_mining.html @@ -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/
# 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 |
APP_KEVACOIN_ROOM_NAMESPACES_READONLY=
# Redirect from index page to default room
APP_KEVACOIN_ROOM_NAMESPACE_DEFAULT=EDIT_ME
APP_KEVACOIN_ROOM_NAMESPACE_DEFAULT=
# Session expire
APP_SESSION_DEFAULT_TIMEOUT=2592000

2
README.md

@ -62,7 +62,7 @@ Application package contain settings preset, just few steps required to launch: @@ -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
* 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"`
* 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

21
src/Controller/RoomController.php

@ -29,12 +29,21 @@ class RoomController extends AbstractController @@ -29,12 +29,21 @@ class RoomController extends AbstractController
?Request $request
): Response
{
return $this->redirectToRoute(
'room_namespace',
[
'namespace' => $request->get('namespace') ? $request->get('namespace') : $this->getParameter('app.kevacoin.room.namespace.default'),
'_fragment' => 'latest'
]
// Redirect to default room on defined
if ($this->getParameter('app.kevacoin.room.namespace.default'))
{
return $this->redirectToRoute(
'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 @@ @@ -23,7 +23,7 @@
{% endif %}
<h2>
<i>
{% if 'room_list' == request.get('_route') %}
{% if 'room_index' == request.get('_route') || 'room_list' == request.get('_route') %}
{{ 'rooms' | trans }}
{% else %}
<a href="{{ path('room_list') }}">{{ 'rooms' | trans }}</a>

Loading…
Cancel
Save