Commit graph

426 commits

Author SHA1 Message Date
17ab181adb
guard text.js node fetch on non-ok response 2026-05-03 17:32:48 +03:00
33668e2930
add logout button to today and userText 2026-05-03 17:25:31 +03:00
e83f098280
add seeding for manual testing 2026-05-03 17:25:08 +03:00
2a75062514
add logout tests for all authed pages 2026-05-03 17:11:12 +03:00
ca328724b3
Merge branch 'fix/handle-forbidden-text' 2026-05-03 16:37:02 +03:00
b5040fff14
handle forbidden and not found errors on text page 2026-05-03 16:36:57 +03:00
a71cd641dc
add tests for forbidden and not found text 2026-05-03 16:36:57 +03:00
03a33e1ef6
remove todo from readme 2026-05-03 16:36:09 +03:00
cb83402c71
add task to readme 2026-05-02 22:54:07 +03:00
3b29c7b90f
Merge branch 'text-has-user' 2026-05-02 22:40:39 +03:00
24d01b5908
text has user update in drawio 2026-05-02 22:40:18 +03:00
507922bf55
add cy request anti pattern 2026-05-02 22:40:09 +03:00
d97c2cdf07
update todos 2026-05-02 22:40:00 +03:00
cebed26cde
require user arg in bulk node test helper 2026-05-02 22:22:21 +03:00
5d6c9f7ec9
add llm anti-patterns to context files
name the LLM-default constructs this project forbids in
explicit before/after tables. catching the trap by pattern
match is more reliable than expecting a general rule to be
applied at write time. backend table covers PHP traps
(arrow fns, inline FQCNs, default params, stored refs, em
dashes, short names); frontend table covers JS/template/
cypress traps.
2026-05-02 22:15:23 +03:00
b07b1e2666
add session start protocol and pre-commit checklist
AGENTS.md gains a non-negotiable session start protocol that
forces reading the context files and checking the current
branch before any edits. shared.md gains a pre-commit
checklist covering branch/scope, code rules, mechanical
checks, and commit metadata. both additions exist because
this branch's history shows what happens when the rules are
treated as background information rather than active
checklists.
2026-05-02 22:14:54 +03:00
db93871194
move inline use statements to file headers
two type hints introduced earlier on this branch referenced
classes by their fully-qualified names inline. hoist them to
the top-of-file use block per backend-context.md PHP rules.
2026-05-02 22:05:58 +03:00
3a1e91cc4f
scope user text child-add cypress selectors
the seeded text already has nested nodes, so 'li.first()'
matched multiple buttons. scope the selectors to top-level
li children to match the working pattern in adminText.cy.js.
2026-05-02 21:58:34 +03:00
c065e065e9
fix admin texts route shadow conflict
FastRoute rejected /api/texts/all because the previously
declared variable route /api/texts/{textId} would shadow it,
crashing the app on boot. move the admin all-texts endpoint
to /api/admin/texts to clear the conflict; admin texts.js
follows the new URL.
2026-05-02 21:54:43 +03:00
71e5fb8fda
add cypress coverage for user text pages
loginAsSecondUser helper backs new specs that cover the
/texts list (own-only scoping, create form, link to
/texts/{id}) and /texts/{id} detail (own access, 403 on
another user's text, owner can add a child node).
2026-05-02 21:47:20 +03:00
6d11f7e887
add user texts and text detail pages
new /texts page lets a user manage their own texts (list +
create form linking to /texts/{id}); /texts/{id} reuses
text.js for the node tree, with a back link to /texts. home
gains a 'My texts' link in the header. the admin texts page
now sources its cross-user list from /api/texts/all.
2026-05-02 21:46:41 +03:00
7473af4163
enforce text ownership on node endpoints
getNodesOfText, createNode, and bulkCreateNodes now require
the session user, look up the target text, and respond 403
unless the user owns the text or is an admin. paves the way
for moving these endpoints out of the admin-only group.
2026-05-02 21:45:47 +03:00
e56cb56ce7
test node controller ownership checks
add failing tests asserting 403 when a non-owner tries to
read or write nodes on another user's text, plus admin
bypass. existing tests now attach a session user to mirror
the new controller signature.
2026-05-02 21:45:15 +03:00
051e44033f
wire user texts routes and update seed
open POST /api/texts and node create endpoints to any
authenticated user; expose new /texts and /texts/{id} pages
plus admin-only GET /api/texts/all. ViewController gains
userTexts and userText methods. seed gives Tanach to the
regular user and adds a second non-admin user.
2026-05-02 21:43:48 +03:00
acdf703d80
scope text endpoints by ownership
TextRepository gains findByUser; JsonTextRepository and the
fake implement filtering by stored userId. TextController
splits the list endpoint into getMyTexts (own) and
getAllTexts (admin), and getText now requires the session
user, returning 403 to non-owners while admins bypass.
2026-05-02 21:42:51 +03:00
ea6d65a77d
test text controller scoping and ownership
add failing tests for getMyTexts (own-only), getAllTexts
(admin), getText 403 for non-owner, and admin bypass on
getText. existing test_get_one_text updated to pass the
session user via the new request signature.
2026-05-02 21:41:52 +03:00
cbbbc80326
update downstream tests for text user requirement
Text now requires a User on construction. seed a user in
each test setUp that creates a Text directly or through the
fake repository so the suite remains green.
2026-05-02 21:27:55 +03:00
40fdf25da2
add tests for text user relationship
cover that the created Text carries the supplied User, that
the controller persists the user from the session attribute,
and that any userId in the request body is ignored.
2026-05-02 21:27:49 +03:00
6668240126
update fake text repository for user
include the user when rebuilding Text instances in find and
getAll, preserving the rule that lookup methods return new
instances rather than stored references.
2026-05-02 21:27:45 +03:00
4635fef3c7
persist user id in json text repository
store userId in the json record and rehydrate the User via
UserRepository. throws DomainException if the referenced user
no longer exists.
2026-05-02 21:27:40 +03:00
bac8323806
extract user from session in text controller
prevent payload from spoofing ownership by reading the user
from the request attribute set by auth middleware. respond 401
when unauthenticated.
2026-05-02 21:27:36 +03:00
bf006220e8
pass user object to create text use case
drop UserRepository dependency; controller now passes the
authenticated User directly via CreateTextRequest, eliminating
a redundant repository lookup.
2026-05-02 21:27:32 +03:00
ffef0ddff6
add user property to text entity 2026-05-02 21:27:28 +03:00
dfa0bc6c00
Merge branch 'add-form-ux' 2026-05-02 20:48:14 +03:00
a1bfe4f7c1
close other add forms when opening a new one
introduce closeAllAddForms which strips every add-child and
bulk-add input/button from the tree, and call it at the start of
toggleAddForm and toggleBulkAddForm (after the same-li toggle-off
short-circuit, so clicking the same trigger still closes its own
form). enforces a single open add form across the whole tree.
2026-05-01 11:58:12 +03:00
d61d68571d
test only one add form open at a time
assert that opening any add-child or bulk-add form closes any
other open add form across the tree. currently fails: each toggle
function only checks for an open form on its own li.
2026-05-01 11:56:44 +03:00
bd14bfd7a1
submit bulk add form on enter key
extract the save-bulk handler into a submit closure shared by the
save button click and a keydown listener on both the title and
count inputs. focus the title input as soon as the form opens.
2026-05-01 11:55:43 +03:00
ff8ec9a2ab
test enter submits bulk add form
assert that pressing enter from either the bulk-title or
bulk-count input submits the bulk add form. currently fails:
only the save-bulk button click triggers the post.
2026-05-01 11:54:53 +03:00
3928fef213
submit add child form on enter key
extract the save-child handler into a submit closure shared by
the save button click and a keydown listener on the input. also
focus the input as soon as the form opens so the user can type
and hit enter without touching the mouse.
2026-05-01 11:53:54 +03:00
74705379cb
test enter submits add child form
assert that pressing enter while typing in the add-child input
submits the form. currently fails: only the save-child button
click triggers the post.
2026-05-01 11:53:06 +03:00
838c31293e
Merge branch 'preserve-tree-expansion' 2026-05-01 11:48:49 +03:00
1342a67cf3
preserve expanded state across node re-render
introduce a module-level expandedNodeIds set that tracks which
nodes the user has manually expanded. renderTree consults the set
when deciding initial visibility (falling back to the depth-based
default for a fresh load), the toggle click handler keeps the set
in sync, and both add-child save handlers add the parent's id
before triggering the re-fetch. on a fresh load the set starts
empty so root-only-open behavior is unchanged and the existing
toggle tests keep passing.
2026-05-01 11:45:55 +03:00
dce4e4a4f6
test child add keeps parent expanded
assert that a non-root parent that the user expanded stays expanded
after adding a child. currently fails: fetchAndRenderNodes wipes
and rebuilds the tree with depth-based default visibility, so any
manually expanded non-root collapses on every save.
2026-05-01 11:44:24 +03:00
a9a7461aad
Merge branch 'style-foundation' 2026-05-01 11:37:46 +03:00
9979178fd5
style forbidden page with auth-card layout
reuse the centered auth-card shell for the 403 page so the error
state matches the visual language of the rest of the app, with a
primary back-to-home action.
2026-05-01 11:33:49 +03:00
8d38a092d8
style register page with auth-card layout
apply the shared auth-shell + auth-card layout to the register
template, mirroring the login page. ids and the #register-error
element are preserved for the existing cypress auth tests.
2026-05-01 11:33:37 +03:00
a20d12177e
style login page with auth-card layout
introduce .auth-shell and .auth-card classes for the centered,
narrow-card layout shared by login and register, then apply them
to the login template. form ids and the #login-error element are
preserved so the existing cypress auth flows still target them.
2026-05-01 11:33:24 +03:00
e51378b8c7
style admin landing page with shell and card nav
wrap the admin page in the shared header (with the logout button)
and present the texts entry-point as a card-link in a list-cards
list. the #texts and #logout id hooks used by cypress are
preserved.
2026-05-01 11:33:05 +03:00
59ec2e19e8
style admin text detail page with node tree
apply the page shell to the text detail page and add a scoped
.node-tree style block to app.css. the tree dom rendered by text.js
must keep ul/li with buttons and inputs as direct children of each
li (cypress relies on > selectors), so styling is applied entirely
via descendant selectors without wrapping the rendered nodes.
2026-05-01 11:32:49 +03:00
5be645f4e5
style admin texts page with card list and form
apply the page shell to the admin texts page and present each
existing text as a card-link plus the new-text form as a card with
a primary submit button. ids (#texts-list, #newTextName, #submit,
#back) and the name attribute on the input are preserved so the
existing cypress flows continue to work.
2026-05-01 11:32:21 +03:00