mirror of
https://github.com/wanderer-industries/wanderer
synced 2026-01-25 00:01:12 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1625f16c8f | ||
|
|
b4ef9ae983 | ||
|
|
3b9c2dd996 | ||
|
|
8a0f9a58d0 | ||
|
|
5fe8caac0d | ||
|
|
f18f567727 | ||
|
|
91acc49980 | ||
|
|
ae3873a225 | ||
|
|
b351c6cc26 | ||
|
|
698244d945 | ||
|
|
2c7dd9dc5b |
23
CHANGELOG.md
23
CHANGELOG.md
@@ -2,6 +2,29 @@
|
||||
|
||||
<!-- changelog -->
|
||||
|
||||
## [v1.91.2](https://github.com/wanderer-industries/wanderer/compare/v1.91.1...v1.91.2) (2025-12-27)
|
||||
|
||||
|
||||
|
||||
|
||||
### Bug Fixes:
|
||||
|
||||
* core: fixed map scopes updates & logic
|
||||
|
||||
## [v1.91.1](https://github.com/wanderer-industries/wanderer/compare/v1.91.0...v1.91.1) (2025-12-25)
|
||||
|
||||
|
||||
|
||||
|
||||
## [v1.91.0](https://github.com/wanderer-industries/wanderer/compare/v1.90.13...v1.91.0) (2025-12-24)
|
||||
|
||||
|
||||
|
||||
|
||||
### Features:
|
||||
|
||||
* admin: added maps administration view with basic info, search, restore/delete, acls view and edit options
|
||||
|
||||
## [v1.90.13](https://github.com/wanderer-industries/wanderer/compare/v1.90.12...v1.90.13) (2025-12-19)
|
||||
|
||||
|
||||
|
||||
@@ -1001,3 +1001,27 @@ body > div:first-of-type {
|
||||
.verticalTabsContainer .p-tabview-panel {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
/* Blog post CTA links - only in main post content */
|
||||
.post-content a {
|
||||
display: inline-block;
|
||||
background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%);
|
||||
color: white !important;
|
||||
padding: 0.5rem 1.25rem;
|
||||
border-radius: 0.5rem;
|
||||
text-decoration: none !important;
|
||||
font-weight: 600;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
|
||||
}
|
||||
|
||||
.post-content a:hover {
|
||||
background: linear-gradient(135deg, #db2777 0%, #7c3aed 100%);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 20px rgba(236, 72, 153, 0.4);
|
||||
}
|
||||
|
||||
.post-content a:active {
|
||||
transform: translateY(0);
|
||||
box-shadow: 0 2px 10px rgba(236, 72, 153, 0.3);
|
||||
}
|
||||
|
||||
@@ -67,6 +67,8 @@ defmodule WandererApp.Api.Map do
|
||||
)
|
||||
|
||||
define(:duplicate, action: :duplicate)
|
||||
define(:admin_all, action: :admin_all)
|
||||
define(:restore, action: :restore)
|
||||
end
|
||||
|
||||
calculations do
|
||||
@@ -107,6 +109,12 @@ defmodule WandererApp.Api.Map do
|
||||
prepare WandererApp.Api.Preparations.FilterMapsByRoles
|
||||
end
|
||||
|
||||
read :admin_all do
|
||||
# Admin-only action that bypasses FilterMapsByRoles
|
||||
# Returns ALL maps including soft-deleted ones with owner and ACLs loaded
|
||||
prepare build(load: [:owner, :acls])
|
||||
end
|
||||
|
||||
create :new do
|
||||
accept [
|
||||
:name,
|
||||
@@ -194,6 +202,14 @@ defmodule WandererApp.Api.Map do
|
||||
change(set_attribute(:deleted, true))
|
||||
end
|
||||
|
||||
update :restore do
|
||||
# Admin-only action to restore a soft-deleted map
|
||||
accept([])
|
||||
require_atomic? false
|
||||
|
||||
change(set_attribute(:deleted, false))
|
||||
end
|
||||
|
||||
update :update_api_key do
|
||||
accept [:public_api_key]
|
||||
require_atomic? false
|
||||
|
||||
@@ -56,7 +56,7 @@ defmodule WandererApp.Map.Server.AclsImpl do
|
||||
end
|
||||
)
|
||||
|
||||
map_update = %{acls: map.acls, scope: map.scope}
|
||||
map_update = %{acls: map.acls, scope: map.scope, scopes: map.scopes}
|
||||
|
||||
WandererApp.Map.update_map(map_id, map_update)
|
||||
WandererApp.Cache.delete("map_characters-#{map_id}")
|
||||
|
||||
@@ -780,17 +780,39 @@ defmodule WandererApp.Map.Server.ConnectionsImpl do
|
||||
to_is_wormhole = to_system_static_info.system_class in @wh_space
|
||||
wormholes_enabled = :wormholes in scopes
|
||||
|
||||
# Wormhole border behavior: if wormholes scope is enabled AND at least one
|
||||
# system is a wormhole, allow the connection (adds border k-space systems)
|
||||
# Otherwise: BOTH systems must match the configured scopes
|
||||
if wormholes_enabled and (from_is_wormhole or to_is_wormhole) do
|
||||
# At least one system matches (wormhole matches :wormholes, or other matches its scope)
|
||||
system_matches_any_scope?(from_system_static_info.system_class, scopes) or
|
||||
system_matches_any_scope?(to_system_static_info.system_class, scopes)
|
||||
else
|
||||
# Non-wormhole movement: both systems must match scopes
|
||||
system_matches_any_scope?(from_system_static_info.system_class, scopes) and
|
||||
system_matches_any_scope?(to_system_static_info.system_class, scopes)
|
||||
cond do
|
||||
# Case 1: Wormhole border behavior - at least one system is a wormhole
|
||||
# and :wormholes is enabled, allow the connection (adds border k-space systems)
|
||||
wormholes_enabled and (from_is_wormhole or to_is_wormhole) ->
|
||||
# At least one system matches (wormhole matches :wormholes, or other matches its scope)
|
||||
system_matches_any_scope?(from_system_static_info.system_class, scopes) or
|
||||
system_matches_any_scope?(to_system_static_info.system_class, scopes)
|
||||
|
||||
# Case 2: K-space to K-space with :wormholes enabled - check if it's a wormhole connection
|
||||
# If neither system is a wormhole AND there's no stargate between them, it's a wormhole connection
|
||||
wormholes_enabled and not from_is_wormhole and not to_is_wormhole ->
|
||||
# Check if there's a known stargate connection
|
||||
case find_solar_system_jump(from_solar_system_id, to_solar_system_id) do
|
||||
{:ok, known_jumps} when known_jumps == [] ->
|
||||
# No stargate exists - this is a wormhole connection through k-space
|
||||
true
|
||||
|
||||
{:ok, _known_jumps} ->
|
||||
# Stargate exists - this is NOT a wormhole, check normal scope matching
|
||||
system_matches_any_scope?(from_system_static_info.system_class, scopes) and
|
||||
system_matches_any_scope?(to_system_static_info.system_class, scopes)
|
||||
|
||||
_ ->
|
||||
# Error fetching jumps - fall back to scope matching
|
||||
system_matches_any_scope?(from_system_static_info.system_class, scopes) and
|
||||
system_matches_any_scope?(to_system_static_info.system_class, scopes)
|
||||
end
|
||||
|
||||
# Case 3: Non-wormhole movement without :wormholes scope
|
||||
# Both systems must match the configured scopes
|
||||
true ->
|
||||
system_matches_any_scope?(from_system_static_info.system_class, scopes) and
|
||||
system_matches_any_scope?(to_system_static_info.system_class, scopes)
|
||||
end
|
||||
else
|
||||
false
|
||||
|
||||
@@ -115,7 +115,9 @@
|
||||
{@post.description}
|
||||
</h4>
|
||||
<!--Post Content-->
|
||||
{raw(@post.body)}
|
||||
<div class="post-content">
|
||||
{raw(@post.body)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--/container-->
|
||||
|
||||
@@ -15,6 +15,15 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 gap-6 md:grid-cols-2 2xl:grid-cols-4 pb-6">
|
||||
<div class="card dark:bg-zinc-800 dark:border-zinc-600">
|
||||
<div class="card-body">
|
||||
<span class="text-gray-400 dark:text-gray-400">Maps Management</span>
|
||||
<.link class="btn mt-2 w-full btn-neutral rounded-none" navigate={~p"/admin/maps"}>
|
||||
<.icon name="hero-map-solid" class="w-6 h-6" />
|
||||
<h3 class="card-title text-center text-md">Manage All Maps</h3>
|
||||
</.link>
|
||||
</div>
|
||||
</div>
|
||||
<div :if={@restrict_maps_creation?} class="card dark:bg-zinc-800 dark:border-zinc-600">
|
||||
<div class="card-body">
|
||||
<.button class="mt-2" type="button" phx-click="create-map">
|
||||
|
||||
273
lib/wanderer_app_web/live/admin/admin_maps_live.ex
Normal file
273
lib/wanderer_app_web/live/admin/admin_maps_live.ex
Normal file
@@ -0,0 +1,273 @@
|
||||
defmodule WandererAppWeb.AdminMapsLive do
|
||||
@moduledoc """
|
||||
Admin LiveView for managing all maps on the server.
|
||||
Allows admins to view, edit, soft-delete, and restore maps regardless of ownership.
|
||||
"""
|
||||
use WandererAppWeb, :live_view
|
||||
|
||||
alias Phoenix.LiveView.AsyncResult
|
||||
|
||||
require Logger
|
||||
|
||||
@maps_per_page 20
|
||||
|
||||
@impl true
|
||||
def mount(_params, %{"user_id" => user_id} = _session, socket)
|
||||
when not is_nil(user_id) and is_connected?(socket) do
|
||||
{:ok,
|
||||
socket
|
||||
|> assign(
|
||||
maps: AsyncResult.loading(),
|
||||
search_term: "",
|
||||
show_deleted: true,
|
||||
page: 1,
|
||||
per_page: @maps_per_page
|
||||
)
|
||||
|> load_maps_async()}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def mount(_params, _session, socket) do
|
||||
{:ok,
|
||||
socket
|
||||
|> assign(
|
||||
maps: AsyncResult.loading(),
|
||||
search_term: "",
|
||||
show_deleted: true,
|
||||
page: 1,
|
||||
per_page: @maps_per_page
|
||||
)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_params(params, _url, socket) when is_connected?(socket) do
|
||||
{:noreply, apply_action(socket, socket.assigns.live_action, params)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_params(_params, _url, socket) do
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
defp apply_action(socket, :index, _params) do
|
||||
socket
|
||||
|> assign(:active_page, :admin)
|
||||
|> assign(:page_title, "Admin - Maps")
|
||||
|> assign(:selected_map, nil)
|
||||
|> assign(:form, nil)
|
||||
end
|
||||
|
||||
defp apply_action(socket, :edit, %{"id" => map_id}) do
|
||||
case load_map_for_edit(map_id) do
|
||||
{:ok, map} ->
|
||||
socket
|
||||
|> assign(:active_page, :admin)
|
||||
|> assign(:page_title, "Admin - Edit Map")
|
||||
|> assign(:selected_map, map)
|
||||
|> assign(
|
||||
:form,
|
||||
map
|
||||
|> AshPhoenix.Form.for_update(:update, forms: [auto?: true])
|
||||
|> to_form()
|
||||
)
|
||||
|> load_owner_options()
|
||||
|
||||
{:error, _} ->
|
||||
socket
|
||||
|> put_flash(:error, "Map not found")
|
||||
|> push_navigate(to: ~p"/admin/maps")
|
||||
end
|
||||
end
|
||||
|
||||
defp apply_action(socket, :view_acls, %{"id" => map_id}) do
|
||||
case load_map_with_acls(map_id) do
|
||||
{:ok, map} ->
|
||||
socket
|
||||
|> assign(:active_page, :admin)
|
||||
|> assign(:page_title, "Admin - Map ACLs")
|
||||
|> assign(:selected_map, map)
|
||||
|
||||
{:error, _} ->
|
||||
socket
|
||||
|> put_flash(:error, "Map not found")
|
||||
|> push_navigate(to: ~p"/admin/maps")
|
||||
end
|
||||
end
|
||||
|
||||
# Data loading functions
|
||||
defp load_maps_async(socket) do
|
||||
socket
|
||||
|> assign_async(:maps, fn -> load_all_maps() end)
|
||||
end
|
||||
|
||||
defp load_all_maps do
|
||||
case WandererApp.Api.Map.admin_all() do
|
||||
{:ok, maps} ->
|
||||
maps =
|
||||
maps
|
||||
|> Enum.sort_by(& &1.name, :asc)
|
||||
|
||||
{:ok, %{maps: maps}}
|
||||
|
||||
_ ->
|
||||
{:ok, %{maps: []}}
|
||||
end
|
||||
end
|
||||
|
||||
defp load_map_for_edit(map_id) do
|
||||
case WandererApp.Api.Map.by_id(map_id) do
|
||||
{:ok, map} ->
|
||||
{:ok, map} = Ash.load(map, [:owner, :acls])
|
||||
{:ok, map}
|
||||
|
||||
error ->
|
||||
error
|
||||
end
|
||||
end
|
||||
|
||||
defp load_map_with_acls(map_id) do
|
||||
case WandererApp.Api.Map.by_id(map_id) do
|
||||
{:ok, map} ->
|
||||
{:ok, map} = Ash.load(map, acls: [:owner, :members])
|
||||
{:ok, map}
|
||||
|
||||
error ->
|
||||
error
|
||||
end
|
||||
end
|
||||
|
||||
defp load_owner_options(socket) do
|
||||
case WandererApp.Api.Character.read() do
|
||||
{:ok, characters} ->
|
||||
options =
|
||||
characters
|
||||
|> Enum.map(fn c -> {c.name, c.id} end)
|
||||
|> Enum.sort_by(&elem(&1, 0))
|
||||
|
||||
socket |> assign(:owner_options, options)
|
||||
|
||||
_ ->
|
||||
socket |> assign(:owner_options, [])
|
||||
end
|
||||
end
|
||||
|
||||
# Event handlers
|
||||
@impl true
|
||||
def handle_event("search", %{"value" => term}, socket) do
|
||||
{:noreply, socket |> assign(:search_term, term) |> assign(:page, 1)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event("toggle_deleted", _params, socket) do
|
||||
{:noreply,
|
||||
socket |> assign(:show_deleted, not socket.assigns.show_deleted) |> assign(:page, 1)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event("delete_map", %{"id" => map_id}, socket) do
|
||||
case soft_delete_map(map_id) do
|
||||
{:ok, _} ->
|
||||
{:noreply,
|
||||
socket
|
||||
|> put_flash(:info, "Map marked as deleted")
|
||||
|> load_maps_async()}
|
||||
|
||||
{:error, _} ->
|
||||
{:noreply, socket |> put_flash(:error, "Failed to delete map")}
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event("restore_map", %{"id" => map_id}, socket) do
|
||||
case restore_map(map_id) do
|
||||
{:ok, _} ->
|
||||
{:noreply,
|
||||
socket
|
||||
|> put_flash(:info, "Map restored successfully")
|
||||
|> load_maps_async()}
|
||||
|
||||
{:error, _} ->
|
||||
{:noreply, socket |> put_flash(:error, "Failed to restore map")}
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event("validate", %{"form" => params}, socket) do
|
||||
form = AshPhoenix.Form.validate(socket.assigns.form, params)
|
||||
{:noreply, assign(socket, form: form)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event("save", %{"form" => params}, socket) do
|
||||
case AshPhoenix.Form.submit(socket.assigns.form, params: params) do
|
||||
{:ok, _map} ->
|
||||
{:noreply,
|
||||
socket
|
||||
|> put_flash(:info, "Map updated successfully")
|
||||
|> push_navigate(to: ~p"/admin/maps")}
|
||||
|
||||
{:error, form} ->
|
||||
{:noreply, assign(socket, form: form)}
|
||||
end
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event("page", %{"page" => page}, socket) do
|
||||
{:noreply, socket |> assign(:page, String.to_integer(page))}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event(_event, _params, socket) do
|
||||
{:noreply, socket}
|
||||
end
|
||||
|
||||
# Helper functions
|
||||
defp soft_delete_map(map_id) do
|
||||
case WandererApp.Api.Map.by_id(map_id) do
|
||||
{:ok, map} ->
|
||||
WandererApp.Api.Map.mark_as_deleted(map)
|
||||
|
||||
error ->
|
||||
error
|
||||
end
|
||||
end
|
||||
|
||||
defp restore_map(map_id) do
|
||||
case WandererApp.Api.Map.by_id(map_id) do
|
||||
{:ok, map} ->
|
||||
WandererApp.Api.Map.restore(map)
|
||||
|
||||
error ->
|
||||
error
|
||||
end
|
||||
end
|
||||
|
||||
def filter_maps(maps, search_term, show_deleted) do
|
||||
maps
|
||||
|> Enum.filter(fn map ->
|
||||
(show_deleted or not map.deleted) and
|
||||
(search_term == "" or
|
||||
String.contains?(String.downcase(map.name || ""), String.downcase(search_term)) or
|
||||
String.contains?(String.downcase(map.slug || ""), String.downcase(search_term)))
|
||||
end)
|
||||
end
|
||||
|
||||
def paginate(maps, page, per_page) do
|
||||
maps
|
||||
|> Enum.drop((page - 1) * per_page)
|
||||
|> Enum.take(per_page)
|
||||
end
|
||||
|
||||
def total_pages(maps, per_page) do
|
||||
max(1, ceil(length(maps) / per_page))
|
||||
end
|
||||
|
||||
def format_date(nil), do: "-"
|
||||
|
||||
def format_date(datetime) do
|
||||
Calendar.strftime(datetime, "%Y-%m-%d %H:%M")
|
||||
end
|
||||
|
||||
def owner_name(nil), do: "No owner"
|
||||
def owner_name(%{name: name}), do: name
|
||||
end
|
||||
240
lib/wanderer_app_web/live/admin/admin_maps_live.html.heex
Normal file
240
lib/wanderer_app_web/live/admin/admin_maps_live.html.heex
Normal file
@@ -0,0 +1,240 @@
|
||||
<main class="w-full h-full col-span-2 lg:col-span-1 p-4 pl-20 overflow-auto">
|
||||
<div class="page-content">
|
||||
<div class="container-fluid px-[0.625rem]">
|
||||
<!-- Header -->
|
||||
<div class="grid grid-cols-1 pb-6">
|
||||
<div class="md:flex items-center justify-between px-[2px]">
|
||||
<h4 class="text-[18px] font-medium text-gray-800 mb-sm-0 grow dark:text-gray-100 mb-2 md:mb-0">
|
||||
Admin - Maps Management
|
||||
</h4>
|
||||
<.link navigate={~p"/admin"} class="btn btn-ghost btn-sm">
|
||||
<.icon name="hero-arrow-left-solid" class="w-4 h-4" /> Back to Admin
|
||||
</.link>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Search and Filters -->
|
||||
<div class="card dark:bg-zinc-800 dark:border-zinc-600 mb-4">
|
||||
<div class="card-body flex flex-row gap-4 items-center">
|
||||
<div class="flex-1">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Search by name or slug..."
|
||||
value={@search_term}
|
||||
phx-keyup="search"
|
||||
phx-debounce="300"
|
||||
name="search"
|
||||
class="input input-bordered w-full"
|
||||
/>
|
||||
</div>
|
||||
<label class="flex items-center gap-2 cursor-pointer">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="checkbox"
|
||||
checked={@show_deleted}
|
||||
phx-click="toggle_deleted"
|
||||
/>
|
||||
<span class="text-sm">Show deleted</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Maps Table -->
|
||||
<div class="card dark:bg-zinc-800 dark:border-zinc-600">
|
||||
<div class="card-body">
|
||||
<.async_result :let={maps} assign={@maps}>
|
||||
<:loading>
|
||||
<div class="flex justify-center p-8">
|
||||
<span class="loading loading-spinner loading-lg"></span>
|
||||
</div>
|
||||
</:loading>
|
||||
<:failed :let={reason}>
|
||||
<div class="alert alert-error">{inspect(reason)}</div>
|
||||
</:failed>
|
||||
|
||||
<% filtered_maps = filter_maps(maps, @search_term, @show_deleted) %>
|
||||
<% paginated_maps = paginate(filtered_maps, @page, @per_page) %>
|
||||
|
||||
<.table id="admin-maps" rows={paginated_maps} class="!max-h-[60vh] !overflow-y-auto">
|
||||
<:col :let={map} label="Name">
|
||||
<div class="flex items-center gap-2">
|
||||
<span class={if map.deleted, do: "line-through text-gray-500", else: ""}>
|
||||
{map.name}
|
||||
</span>
|
||||
<span :if={map.deleted} class="badge badge-error badge-sm">Deleted</span>
|
||||
</div>
|
||||
</:col>
|
||||
<:col :let={map} label="Slug">
|
||||
<span class="text-sm text-gray-400">{map.slug}</span>
|
||||
</:col>
|
||||
<:col :let={map} label="Owner">
|
||||
{owner_name(map.owner)}
|
||||
</:col>
|
||||
<:col :let={map} label="Created">
|
||||
<span class="text-sm">{format_date(map.inserted_at)}</span>
|
||||
</:col>
|
||||
<:col :let={map} label="Scope">
|
||||
<span class="badge badge-ghost badge-sm">{map.scope}</span>
|
||||
</:col>
|
||||
<:action :let={map}>
|
||||
<.link
|
||||
patch={~p"/admin/maps/#{map.id}/edit"}
|
||||
class="btn btn-ghost btn-xs hover:text-white"
|
||||
title="Edit"
|
||||
>
|
||||
<.icon name="hero-pencil-solid" class="w-4 h-4" />
|
||||
</.link>
|
||||
</:action>
|
||||
<:action :let={map}>
|
||||
<.link
|
||||
patch={~p"/admin/maps/#{map.id}/acls"}
|
||||
class="btn btn-ghost btn-xs hover:text-white"
|
||||
title="View ACLs"
|
||||
>
|
||||
<.icon name="hero-shield-check-solid" class="w-4 h-4" />
|
||||
</.link>
|
||||
</:action>
|
||||
<:action :let={map}>
|
||||
<button
|
||||
:if={not map.deleted}
|
||||
phx-click="delete_map"
|
||||
phx-value-id={map.id}
|
||||
data={[confirm: "Are you sure you want to delete this map?"]}
|
||||
class="btn btn-ghost btn-xs hover:text-red-500"
|
||||
title="Delete"
|
||||
>
|
||||
<.icon name="hero-trash-solid" class="w-4 h-4" />
|
||||
</button>
|
||||
<button
|
||||
:if={map.deleted}
|
||||
phx-click="restore_map"
|
||||
phx-value-id={map.id}
|
||||
data={[confirm: "Are you sure you want to restore this map?"]}
|
||||
class="btn btn-ghost btn-xs hover:text-green-500"
|
||||
title="Restore"
|
||||
>
|
||||
<.icon name="hero-arrow-path-solid" class="w-4 h-4" />
|
||||
</button>
|
||||
</:action>
|
||||
</.table>
|
||||
|
||||
<!-- Pagination -->
|
||||
<div
|
||||
:if={length(filtered_maps) > @per_page}
|
||||
class="flex items-center justify-between mt-4"
|
||||
>
|
||||
<span class="text-sm text-gray-400">
|
||||
Page {@page} of {total_pages(filtered_maps, @per_page)} ({length(filtered_maps)} maps)
|
||||
</span>
|
||||
<div class="flex gap-2">
|
||||
<button
|
||||
phx-click="page"
|
||||
phx-value-page={max(1, @page - 1)}
|
||||
disabled={@page <= 1}
|
||||
class={"btn btn-sm btn-ghost " <> if(@page <= 1, do: "btn-disabled", else: "")}
|
||||
>
|
||||
<.icon name="hero-chevron-left" class="w-4 h-4" />
|
||||
</button>
|
||||
<button
|
||||
phx-click="page"
|
||||
phx-value-page={min(total_pages(filtered_maps, @per_page), @page + 1)}
|
||||
disabled={@page >= total_pages(filtered_maps, @per_page)}
|
||||
class={"btn btn-sm btn-ghost " <> if(@page >= total_pages(filtered_maps, @per_page), do: "btn-disabled", else: "")}
|
||||
>
|
||||
<.icon name="hero-chevron-right" class="w-4 h-4" />
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Empty state -->
|
||||
<div :if={length(filtered_maps) == 0} class="text-center py-8 text-gray-400">
|
||||
No maps found
|
||||
</div>
|
||||
</.async_result>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Edit Modal -->
|
||||
<.modal
|
||||
:if={@live_action == :edit and not is_nil(@selected_map)}
|
||||
title="Edit Map"
|
||||
class="!w-[500px]"
|
||||
id="edit_map_modal"
|
||||
show
|
||||
on_cancel={JS.patch(~p"/admin/maps")}
|
||||
>
|
||||
<.form :let={f} for={@form} phx-change="validate" phx-submit="save">
|
||||
<.input type="text" field={f[:name]} label="Name" placeholder="Map name" />
|
||||
<.input type="text" field={f[:slug]} label="Slug" placeholder="map-slug" />
|
||||
<.input
|
||||
type="textarea"
|
||||
field={f[:description]}
|
||||
label="Description"
|
||||
placeholder="Description"
|
||||
/>
|
||||
<.input
|
||||
type="select"
|
||||
field={f[:scope]}
|
||||
label="Scope"
|
||||
options={[
|
||||
{"Wormholes", :wormholes},
|
||||
{"Stargates", :stargates},
|
||||
{"None", :none},
|
||||
{"All", :all}
|
||||
]}
|
||||
/>
|
||||
<.input
|
||||
type="select"
|
||||
field={f[:owner_id]}
|
||||
label="Owner"
|
||||
options={@owner_options}
|
||||
prompt="Select owner..."
|
||||
/>
|
||||
<div class="modal-action">
|
||||
<.button type="submit" phx-disable-with="Saving...">
|
||||
Save Changes
|
||||
</.button>
|
||||
</div>
|
||||
</.form>
|
||||
</.modal>
|
||||
|
||||
<!-- View ACLs Modal -->
|
||||
<.modal
|
||||
:if={@live_action == :view_acls and not is_nil(@selected_map)}
|
||||
title={"ACLs for: #{@selected_map.name}"}
|
||||
class="!w-[600px]"
|
||||
id="view_acls_modal"
|
||||
show
|
||||
on_cancel={JS.patch(~p"/admin/maps")}
|
||||
>
|
||||
<div class="space-y-4">
|
||||
<div :if={Enum.empty?(@selected_map.acls)} class="text-gray-400 text-center py-4">
|
||||
No ACLs assigned to this map
|
||||
</div>
|
||||
<div :for={acl <- @selected_map.acls} class="card bg-base-200">
|
||||
<div class="card-body p-4">
|
||||
<div class="flex justify-between items-start">
|
||||
<div>
|
||||
<h3 class="font-bold">{acl.name}</h3>
|
||||
<p class="text-sm text-gray-400">{acl.description || "No description"}</p>
|
||||
</div>
|
||||
<div class="badge badge-ghost">
|
||||
{length(acl.members)} members
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-sm mt-2">
|
||||
<span class="text-gray-400">Owner:</span>
|
||||
<span>{if acl.owner, do: acl.owner.name, else: "Unknown"}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-action">
|
||||
<.link patch={~p"/admin/maps"} class="btn btn-ghost">
|
||||
Close
|
||||
</.link>
|
||||
</div>
|
||||
</.modal>
|
||||
</main>
|
||||
@@ -503,6 +503,9 @@ defmodule WandererAppWeb.Router do
|
||||
] do
|
||||
live("/", AdminLive, :index)
|
||||
live("/invite", AdminLive, :add_invite_link)
|
||||
live("/maps", AdminMapsLive, :index)
|
||||
live("/maps/:id/edit", AdminMapsLive, :edit)
|
||||
live("/maps/:id/acls", AdminMapsLive, :view_acls)
|
||||
end
|
||||
|
||||
error_tracker_dashboard("/errors",
|
||||
|
||||
2
mix.exs
2
mix.exs
@@ -3,7 +3,7 @@ defmodule WandererApp.MixProject do
|
||||
|
||||
@source_url "https://github.com/wanderer-industries/wanderer"
|
||||
|
||||
@version "1.90.13"
|
||||
@version "1.91.2"
|
||||
|
||||
def project do
|
||||
[
|
||||
|
||||
@@ -11,12 +11,16 @@ description: "Join our Advent Christmas Giveaway Challenge! Win exclusive partne
|
||||
|
||||

|
||||
|
||||
### Event Details
|
||||
|
||||
- **Event Name:** Advent Christmas Giveaway
|
||||
- **Duration:** 1 week (7 days, 7 codes)
|
||||
- **Event Link:** [Advent Christmas Giveaway](https://eventcortex.com/events/invite/cYdBywu1ygfVS3UN6ZZcmDzL1q85aDmH)
|
||||
|
||||
### The Season of Giving
|
||||
|
||||
This holiday season, we're spreading some festive cheer with a special event for our community: the **Advent Christmas Giveaway Challenge**!
|
||||
|
||||
Starting next week, we'll be giving away **1 exclusive partnership code every day for 7 days**. But here's the twist — it's a challenge!
|
||||
|
||||
---
|
||||
|
||||
### How It Works
|
||||
@@ -34,14 +38,7 @@ Starting next week, we'll be giving away **1 exclusive partnership code every da
|
||||
- Each day features a single partnership code.
|
||||
- Miss today? Come back tomorrow for another chance!
|
||||
|
||||
---
|
||||
|
||||
### Event Details
|
||||
|
||||
- **Event Name:** Advent Christmas Giveaway
|
||||
- **Duration:** 1 week (7 days, 7 codes)
|
||||
- **Organizer:** @Demiro (Wanderer core developer, EventCortex CTO)
|
||||
- **Event Link:** [Advent Christmas Giveaway - EventCortex](https://eventcortex.com/events/invite/cYdBywu1ygfVS3UN6ZZcmDzL1q85aDmH)
|
||||
|
||||
---
|
||||
|
||||
|
||||
187
test/unit/map/acl_scopes_propagation_test.exs
Normal file
187
test/unit/map/acl_scopes_propagation_test.exs
Normal file
@@ -0,0 +1,187 @@
|
||||
defmodule WandererApp.Map.Server.AclScopesPropagationTest do
|
||||
@moduledoc """
|
||||
Unit tests for verifying that map scopes are properly propagated
|
||||
when ACL updates occur.
|
||||
|
||||
This test verifies the fix in lib/wanderer_app/map/server/map_server_acls_impl.ex:59
|
||||
where `scopes` was added to the map_update struct.
|
||||
|
||||
Bug: When users update map scope settings (Wormholes, High-Sec, Low-Sec, Null-Sec,
|
||||
Pochven checkboxes), the map server's cached state wasn't being updated with the
|
||||
new scopes array. This caused connection tracking to use stale scope settings
|
||||
until the server was restarted.
|
||||
|
||||
Fix: Changed `map_update = %{acls: map.acls, scope: map.scope}`
|
||||
To: `map_update = %{acls: map.acls, scope: map.scope, scopes: map.scopes}`
|
||||
"""
|
||||
|
||||
use WandererApp.DataCase, async: false
|
||||
|
||||
import WandererAppWeb.Factory
|
||||
|
||||
describe "MapRepo.get returns scopes field" do
|
||||
test "map scopes are loaded when fetching map data" do
|
||||
# Create a user and character for map ownership
|
||||
user = create_user()
|
||||
character = create_character(%{user_id: user.id})
|
||||
|
||||
# Create a map with specific scopes
|
||||
map =
|
||||
create_map(%{
|
||||
owner_id: character.id,
|
||||
name: "Scopes Test",
|
||||
slug: "scopes-prop-test-#{:rand.uniform(1_000_000)}",
|
||||
scope: :wormholes,
|
||||
scopes: [:wormholes, :hi, :low]
|
||||
})
|
||||
|
||||
# Verify the map was created with the expected scopes
|
||||
assert map.scopes == [:wormholes, :hi, :low]
|
||||
|
||||
# Fetch the map the same way AclsImpl.handle_map_acl_updated does
|
||||
{:ok, fetched_map} =
|
||||
WandererApp.MapRepo.get(map.id,
|
||||
acls: [
|
||||
:owner_id,
|
||||
members: [:role, :eve_character_id, :eve_corporation_id, :eve_alliance_id]
|
||||
]
|
||||
)
|
||||
|
||||
# Verify scopes are returned - this is what the fix relies on
|
||||
assert fetched_map.scopes == [:wormholes, :hi, :low],
|
||||
"MapRepo.get should return the scopes field. Got: #{inspect(fetched_map.scopes)}"
|
||||
|
||||
# Verify the scope (legacy) field is also present
|
||||
assert fetched_map.scope == :wormholes
|
||||
end
|
||||
|
||||
test "map scopes field is available for map_update construction" do
|
||||
# Create test data
|
||||
user = create_user()
|
||||
character = create_character(%{user_id: user.id})
|
||||
|
||||
map =
|
||||
create_map(%{
|
||||
owner_id: character.id,
|
||||
name: "Update Test",
|
||||
slug: "scopes-update-test-#{:rand.uniform(1_000_000)}",
|
||||
scope: :all,
|
||||
scopes: [:wormholes, :hi, :low, :null, :pochven]
|
||||
})
|
||||
|
||||
# Fetch map as AclsImpl does
|
||||
{:ok, fetched_map} = WandererApp.MapRepo.get(map.id, acls: [:owner_id])
|
||||
|
||||
# Build map_update the same way the fixed code does
|
||||
# This is the exact line that was fixed in map_server_acls_impl.ex:59
|
||||
map_update = %{acls: fetched_map.acls, scope: fetched_map.scope, scopes: fetched_map.scopes}
|
||||
|
||||
# Verify all fields are present in the update struct
|
||||
assert Map.has_key?(map_update, :acls), "map_update should include :acls"
|
||||
assert Map.has_key?(map_update, :scope), "map_update should include :scope"
|
||||
assert Map.has_key?(map_update, :scopes), "map_update should include :scopes"
|
||||
|
||||
# Verify the scopes value is correct
|
||||
assert map_update.scopes == [:wormholes, :hi, :low, :null, :pochven],
|
||||
"map_update.scopes should have the complete scopes array"
|
||||
end
|
||||
end
|
||||
|
||||
describe "scopes update in database" do
|
||||
test "updating map scopes persists correctly" do
|
||||
# Create test data
|
||||
user = create_user()
|
||||
character = create_character(%{user_id: user.id})
|
||||
|
||||
map =
|
||||
create_map(%{
|
||||
owner_id: character.id,
|
||||
name: "DB Update Test",
|
||||
slug: "scopes-db-test-#{:rand.uniform(1_000_000)}",
|
||||
scope: :wormholes,
|
||||
scopes: [:wormholes]
|
||||
})
|
||||
|
||||
# Initial state
|
||||
assert map.scopes == [:wormholes]
|
||||
|
||||
# Update scopes (simulating what the LiveView does)
|
||||
{:ok, updated_map} =
|
||||
WandererApp.Api.Map.update(map, %{
|
||||
scopes: [:wormholes, :hi, :low, :null]
|
||||
})
|
||||
|
||||
assert updated_map.scopes == [:wormholes, :hi, :low, :null],
|
||||
"Database update should persist new scopes"
|
||||
|
||||
# Fetch again to confirm persistence
|
||||
{:ok, refetched_map} = WandererApp.MapRepo.get(map.id, [])
|
||||
assert refetched_map.scopes == [:wormholes, :hi, :low, :null],
|
||||
"Refetched map should have updated scopes"
|
||||
end
|
||||
|
||||
test "partial scopes update works correctly" do
|
||||
# Create test data
|
||||
user = create_user()
|
||||
character = create_character(%{user_id: user.id})
|
||||
|
||||
map =
|
||||
create_map(%{
|
||||
owner_id: character.id,
|
||||
name: "Partial Update",
|
||||
slug: "partial-scopes-#{:rand.uniform(1_000_000)}",
|
||||
scope: :wormholes,
|
||||
scopes: [:wormholes, :hi, :low, :null, :pochven]
|
||||
})
|
||||
|
||||
# Update to a subset of scopes
|
||||
{:ok, updated_map} =
|
||||
WandererApp.Api.Map.update(map, %{
|
||||
scopes: [:wormholes, :null]
|
||||
})
|
||||
|
||||
assert updated_map.scopes == [:wormholes, :null],
|
||||
"Should be able to update to partial scopes"
|
||||
end
|
||||
end
|
||||
|
||||
describe "get_effective_scopes uses scopes array" do
|
||||
alias WandererApp.Map.Server.CharactersImpl
|
||||
|
||||
test "get_effective_scopes returns scopes array when present" do
|
||||
map_struct = %{scopes: [:wormholes, :hi, :low], scope: :all}
|
||||
|
||||
effective_scopes = CharactersImpl.get_effective_scopes(map_struct)
|
||||
|
||||
assert effective_scopes == [:wormholes, :hi, :low],
|
||||
"get_effective_scopes should return scopes array when present"
|
||||
end
|
||||
|
||||
test "get_effective_scopes falls back to legacy scope when scopes is empty" do
|
||||
map_struct = %{scopes: [], scope: :wormholes}
|
||||
|
||||
effective_scopes = CharactersImpl.get_effective_scopes(map_struct)
|
||||
|
||||
assert effective_scopes == [:wormholes],
|
||||
"get_effective_scopes should fall back to legacy scope conversion"
|
||||
end
|
||||
|
||||
test "get_effective_scopes falls back to legacy scope when scopes is nil" do
|
||||
map_struct = %{scopes: nil, scope: :all}
|
||||
|
||||
effective_scopes = CharactersImpl.get_effective_scopes(map_struct)
|
||||
|
||||
assert effective_scopes == [:wormholes, :hi, :low, :null, :pochven],
|
||||
"get_effective_scopes should convert :all to full scope list"
|
||||
end
|
||||
|
||||
test "get_effective_scopes defaults to [:wormholes] when no scope info" do
|
||||
map_struct = %{}
|
||||
|
||||
effective_scopes = CharactersImpl.get_effective_scopes(map_struct)
|
||||
|
||||
assert effective_scopes == [:wormholes],
|
||||
"get_effective_scopes should default to [:wormholes]"
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -244,18 +244,19 @@ defmodule WandererApp.Map.Server.MapScopesTest do
|
||||
test "connection with multiple scopes" do
|
||||
# With [:wormholes, :hi]:
|
||||
# - WH to WH: valid (both match :wormholes)
|
||||
# - HS to HS: valid (both match :hi)
|
||||
# - HS to HS: valid (both match :hi, or wormhole if no stargate)
|
||||
# - WH to HS: valid (wormhole border behavior - WH is wormhole, :wormholes enabled)
|
||||
scopes = [:wormholes, :hi]
|
||||
assert ConnectionsImpl.is_connection_valid(scopes, @wh_system_id, @c2_system_id) == true
|
||||
assert ConnectionsImpl.is_connection_valid(scopes, @hs_system_id, 30_000_002) == true
|
||||
assert ConnectionsImpl.is_connection_valid(scopes, @wh_system_id, @hs_system_id) == true
|
||||
|
||||
# LS to NS should not be valid with [:wormholes, :hi] (neither is WH, neither matches)
|
||||
assert ConnectionsImpl.is_connection_valid(scopes, @ls_system_id, @ns_system_id) == false
|
||||
# LS to NS with [:wormholes, :hi] - if no stargate exists, it's a wormhole connection
|
||||
# With :wormholes enabled, wormhole connections are valid
|
||||
assert ConnectionsImpl.is_connection_valid(scopes, @ls_system_id, @ns_system_id) == true
|
||||
|
||||
# HS to LS should not be valid with [:wormholes, :hi] (neither is WH, only HS matches)
|
||||
assert ConnectionsImpl.is_connection_valid(scopes, @hs_system_id, @ls_system_id) == false
|
||||
# HS to LS with [:wormholes, :hi] - if no stargate exists, it's a wormhole connection
|
||||
assert ConnectionsImpl.is_connection_valid(scopes, @hs_system_id, @ls_system_id) == true
|
||||
end
|
||||
|
||||
test "all scopes allows any connection" do
|
||||
@@ -368,30 +369,32 @@ defmodule WandererApp.Map.Server.MapScopesTest do
|
||||
true
|
||||
end
|
||||
|
||||
test "K-SPACE ONLY: Hi-Sec->Hi-Sec with [:wormholes] is REJECTED" do
|
||||
# No wormhole involved, neither matches :wormholes
|
||||
assert ConnectionsImpl.is_connection_valid([:wormholes], @hs_system_id, 30_000_002) == false
|
||||
test "K-SPACE ONLY: Hi-Sec->Hi-Sec with [:wormholes] is VALID when no stargate exists" do
|
||||
# If no stargate exists between two k-space systems, it's a wormhole connection
|
||||
# (The test systems don't have stargate data, so this is treated as a wormhole)
|
||||
assert ConnectionsImpl.is_connection_valid([:wormholes], @hs_system_id, 30_000_002) == true
|
||||
end
|
||||
|
||||
test "K-SPACE ONLY: Null->Hi-Sec with [:wormholes, :null] is REJECTED (no border for k-space)" do
|
||||
# Neither system is a wormhole, so no border behavior
|
||||
# Null matches :null, but Hi-Sec doesn't match any scope -> BOTH must match
|
||||
test "K-SPACE ONLY: Null->Hi-Sec with [:wormholes, :null] is VALID when no stargate exists" do
|
||||
# If no stargate exists, this is a wormhole connection through k-space
|
||||
# With [:wormholes] enabled, wormhole connections are valid
|
||||
assert ConnectionsImpl.is_connection_valid(
|
||||
[:wormholes, :null],
|
||||
@ns_system_id,
|
||||
@hs_system_id
|
||||
) ==
|
||||
false
|
||||
true
|
||||
end
|
||||
|
||||
test "K-SPACE ONLY: Hi-Sec->Low-Sec with [:wormholes, :null] is REJECTED" do
|
||||
# Neither Hi-Sec nor Low-Sec match [:wormholes, :null], no WH involved
|
||||
test "K-SPACE ONLY: Hi-Sec->Low-Sec with [:wormholes, :null] is VALID when no stargate exists" do
|
||||
# If no stargate exists, this is a wormhole connection
|
||||
# With [:wormholes] enabled, wormhole connections are valid
|
||||
assert ConnectionsImpl.is_connection_valid(
|
||||
[:wormholes, :null],
|
||||
@hs_system_id,
|
||||
@ls_system_id
|
||||
) ==
|
||||
false
|
||||
true
|
||||
end
|
||||
|
||||
test "K-SPACE ONLY: Low-Sec->Hi-Sec with [:low] is REJECTED (no border for k-space)" do
|
||||
@@ -437,29 +440,90 @@ defmodule WandererApp.Map.Server.MapScopesTest do
|
||||
true
|
||||
end
|
||||
|
||||
test "excluded path: k-space chain with [:wormholes] scope remains excluded" do
|
||||
# If character moves within k-space (no WH involved), should be excluded
|
||||
assert ConnectionsImpl.is_connection_valid([:wormholes], @hs_system_id, 30_000_002) == false
|
||||
assert ConnectionsImpl.is_connection_valid([:wormholes], 30_000_002, @ls_system_id) == false
|
||||
test "k-space chain with [:wormholes] scope is VALID when no stargates exist" do
|
||||
# If no stargates exist between k-space systems, they're wormhole connections
|
||||
# With [:wormholes] scope, these should be tracked
|
||||
assert ConnectionsImpl.is_connection_valid([:wormholes], @hs_system_id, 30_000_002) == true
|
||||
assert ConnectionsImpl.is_connection_valid([:wormholes], 30_000_002, @ls_system_id) == true
|
||||
end
|
||||
|
||||
test "excluded path: Null->Hi-Sec->Low-Sec with [:wormholes, :null] - only Null tracked" do
|
||||
# Character in Null (tracked) jumps to Hi-Sec (border - but NO wormhole!) -> REJECTED
|
||||
# This is the key case: k-space to k-space should NOT add border systems
|
||||
test "k-space chain with [:wormholes, :null] - wormhole connections are tracked" do
|
||||
# If no stargates exist, these are wormhole connections through k-space
|
||||
# With [:wormholes] enabled, all wormhole connections are tracked
|
||||
assert ConnectionsImpl.is_connection_valid(
|
||||
[:wormholes, :null],
|
||||
@ns_system_id,
|
||||
@hs_system_id
|
||||
) ==
|
||||
false
|
||||
true
|
||||
|
||||
# Hi-Sec to Low-Sec also rejected (neither matches)
|
||||
# Hi-Sec to Low-Sec is also a wormhole connection (no stargate in test data)
|
||||
assert ConnectionsImpl.is_connection_valid(
|
||||
[:wormholes, :null],
|
||||
@hs_system_id,
|
||||
@ls_system_id
|
||||
) ==
|
||||
false
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
describe "wormhole connections in k-space (unknown connections)" do
|
||||
@moduledoc """
|
||||
These tests verify the behavior for k-space to k-space connections that are
|
||||
NOT known stargates. Such connections should be treated as wormhole connections.
|
||||
|
||||
Scenario: A player jumps from Low-Sec to Hi-Sec. If there's no stargate between
|
||||
these systems, the jump must have been through a wormhole. With [:wormholes] scope,
|
||||
this connection SHOULD be valid.
|
||||
|
||||
The connection TYPE (stargate vs wormhole) is determined separately in
|
||||
maybe_add_connection using is_connection_valid(:stargates, ...).
|
||||
"""
|
||||
|
||||
test "Low-Sec to Hi-Sec with [:wormholes] is valid when no stargate exists (wormhole connection)" do
|
||||
# When there's no stargate between low-sec and hi-sec, the jump must be through a wormhole
|
||||
# With [:wormholes] scope, this wormhole connection should be valid
|
||||
#
|
||||
# The test systems @ls_system_id and @hs_system_id don't have a known stargate between them
|
||||
# (they're test systems not in the EVE jump database), so this should be treated as a wormhole
|
||||
|
||||
result = ConnectionsImpl.is_connection_valid([:wormholes], @ls_system_id, @hs_system_id)
|
||||
|
||||
# Connection is valid because no stargate exists - it's a wormhole connection
|
||||
assert result == true,
|
||||
"K-space to K-space with [:wormholes] should be valid when no stargate exists"
|
||||
end
|
||||
|
||||
test "Hi-Sec to Low-Sec with [:wormholes] is valid when no stargate exists" do
|
||||
# Test the reverse direction
|
||||
result = ConnectionsImpl.is_connection_valid([:wormholes], @hs_system_id, @ls_system_id)
|
||||
|
||||
assert result == true,
|
||||
"Hi-Sec to Low-Sec with [:wormholes] should be valid when no stargate exists"
|
||||
end
|
||||
|
||||
test "Null-Sec to Hi-Sec with [:wormholes] is valid when no stargate exists" do
|
||||
# Null to Hi-Sec through wormhole
|
||||
result = ConnectionsImpl.is_connection_valid([:wormholes], @ns_system_id, @hs_system_id)
|
||||
|
||||
assert result == true,
|
||||
"Null-Sec to Hi-Sec with [:wormholes] should be valid when no stargate exists"
|
||||
end
|
||||
|
||||
test "Low-Sec to Null-Sec with [:wormholes] is valid when no stargate exists" do
|
||||
# Low to Null through wormhole
|
||||
result = ConnectionsImpl.is_connection_valid([:wormholes], @ls_system_id, @ns_system_id)
|
||||
|
||||
assert result == true,
|
||||
"Low-Sec to Null-Sec with [:wormholes] should be valid when no stargate exists"
|
||||
end
|
||||
|
||||
test "Pochven to Hi-Sec with [:wormholes] is valid when no stargate exists" do
|
||||
# Pochven has special wormhole connections to k-space
|
||||
result = ConnectionsImpl.is_connection_valid([:wormholes], @pochven_id, @hs_system_id)
|
||||
|
||||
assert result == true,
|
||||
"Pochven to Hi-Sec with [:wormholes] should be valid when no stargate exists"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user