Skip to content

Commit

Permalink
Merge pull request #23 from versx/default-server-selected
Browse files Browse the repository at this point in the history
If only one server, select it
  • Loading branch information
versx authored Mar 7, 2021
2 parents 6fe54a9 + 3a49e45 commit 6fa4ede
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/routes/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,9 @@ const validateRoles = (req, res) => {
if (requiredRoles.length > 0) {
server.show = guilds.includes(server.id) && utils.hasRole(userRoles, requiredRoles[0].roles);
if (server.show) {
if (servers.length === 1) {
server.selected = true;
}
valid = true;
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/views/navbar.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<select class="form-control .server_selector" id="server_selector" name="server_selector" onchange="onServerChanged()">
<option value="" selected disabled hidden>{{Choose a Server}}</option>
<option value="" {{#nothing_selected}}selected{{/nothing_selected}} disabled hidden>{{Choose a Server}}</option>
<!--<option value="all">{{All}}</option>-->
{{#servers}}
<option value="{{id}}" {{#selected}}selected{{/selected}} {{^show}}hidden{{/show}}>{{name}}</option>
Expand Down

0 comments on commit 6fa4ede

Please sign in to comment.