Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
aisbf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
aisbf
Commits
09f195d6
Commit
09f195d6
authored
May 12, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: restore market dashboard state
parent
87def276
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
middleware.py
aisbf/app/middleware.py
+6
-0
test_dashboard_user_market_controls.py
tests/routes/test_dashboard_user_market_controls.py
+23
-0
No files found.
aisbf/app/middleware.py
View file @
09f195d6
...
@@ -327,6 +327,12 @@ def make_dashboard_context_middleware():
...
@@ -327,6 +327,12 @@ def make_dashboard_context_middleware():
request
.
url
.
hostname
.
endswith
(
'.aisbf.cloud'
))
request
.
url
.
hostname
.
endswith
(
'.aisbf.cloud'
))
is_onion
=
request
.
url
.
hostname
==
'aisbfity4ud6nsht53tsh2iauaur2e4dah2gplcprnikyjpkg72vfjad.onion'
is_onion
=
request
.
url
.
hostname
==
'aisbfity4ud6nsht53tsh2iauaur2e4dah2gplcprnikyjpkg72vfjad.onion'
request
.
state
.
is_aisbf_cloud
=
is_cloud
or
is_onion
request
.
state
.
is_aisbf_cloud
=
is_cloud
or
is_onion
try
:
from
aisbf.database
import
DatabaseRegistry
market_settings
=
DatabaseRegistry
.
get_config_database
()
.
get_market_settings
()
request
.
state
.
market_enabled
=
bool
(
market_settings
.
get
(
'enabled'
))
except
Exception
:
request
.
state
.
market_enabled
=
True
if
request
.
session
.
get
(
'logged_in'
,
False
):
if
request
.
session
.
get
(
'logged_in'
,
False
):
request
.
state
.
welcome_shown
=
request
.
session
.
get
(
'welcome_shown'
,
False
)
request
.
state
.
welcome_shown
=
request
.
session
.
get
(
'welcome_shown'
,
False
)
else
:
else
:
...
...
tests/routes/test_dashboard_user_market_controls.py
View file @
09f195d6
...
@@ -14,6 +14,7 @@ from aisbf.routes.dashboard import market as dashboard_market
...
@@ -14,6 +14,7 @@ from aisbf.routes.dashboard import market as dashboard_market
from
aisbf.routes.dashboard
import
admin
as
dashboard_admin
from
aisbf.routes.dashboard
import
admin
as
dashboard_admin
from
aisbf.routes.dashboard
import
settings
as
dashboard_settings
from
aisbf.routes.dashboard
import
settings
as
dashboard_settings
from
aisbf.routes.dashboard.admin
import
api_save_market_settings
from
aisbf.routes.dashboard.admin
import
api_save_market_settings
from
aisbf.database
import
DatabaseRegistry
sys
.
path
.
insert
(
0
,
str
(
Path
(
__file__
)
.
resolve
()
.
parents
[
2
]))
sys
.
path
.
insert
(
0
,
str
(
Path
(
__file__
)
.
resolve
()
.
parents
[
2
]))
from
main
import
app
from
main
import
app
...
@@ -326,3 +327,25 @@ def test_base_nav_hides_market_link_when_market_disabled(monkeypatch):
...
@@ -326,3 +327,25 @@ def test_base_nav_hides_market_link_when_market_disabled(monkeypatch):
)
)
assert
">Market</a>"
not
in
html
assert
">Market</a>"
not
in
html
def
test_dashboard_context_middleware_hides_market_link_when_market_disabled
(
monkeypatch
):
original_instances
=
DatabaseRegistry
.
_instances
db
=
MarketSettingsDbStub
()
db
.
current
[
"enabled"
]
=
False
DatabaseRegistry
.
_instances
=
{
"config"
:
db
}
templates
=
TemplateCapture
()
monkeypatch
.
setattr
(
dashboard_settings
,
"_templates"
,
templates
)
client
=
TestClient
(
app
)
_login_as_admin
(
client
)
try
:
response
=
client
.
get
(
"/dashboard/settings"
)
finally
:
DatabaseRegistry
.
_instances
=
original_instances
assert
response
.
status_code
==
200
assert
templates
.
calls
[
-
1
][
"request"
]
.
state
.
market_enabled
is
False
assert
">Market</a>"
not
in
response
.
text
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment