aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/api_rooms.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/admin/api_rooms.go')
-rw-r--r--internal/admin/api_rooms.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/admin/api_rooms.go b/internal/admin/api_rooms.go
index 76db231..06e736c 100644
--- a/internal/admin/api_rooms.go
+++ b/internal/admin/api_rooms.go
@@ -726,7 +726,7 @@ func (s *AdminServer) handleRoomLink(w http.ResponseWriter, r *http.Request) {
// Both sides are resolved and serialized before any write, and both
// are applied in one journaled transaction so a failure cannot leave
// an asymmetric link, and one Undo reverses the whole action.
- txn := persistence.NewTransaction(filepath.Join(s.dataDir, ".journal"))
+ txn := persistence.NewTransaction(persistence.JournalDir(s.dataDir))
if err := txn.Replace(pathA, newA, 0644); err != nil {
writeJSONError(w, "write A: "+err.Error(), http.StatusInternalServerError)
return
@@ -868,7 +868,7 @@ func (s *AdminServer) handleRoomLink(w http.ResponseWriter, r *http.Request) {
}
if len(writes) > 0 {
- txn := persistence.NewTransaction(filepath.Join(s.dataDir, ".journal"))
+ txn := persistence.NewTransaction(persistence.JournalDir(s.dataDir))
for _, wr := range writes {
if err := txn.Replace(wr.path, wr.data, 0644); err != nil {
writeJSONError(w, "plan unlink: "+err.Error(), http.StatusInternalServerError)
@@ -932,7 +932,7 @@ func (s *AdminServer) handleRoomMove(w http.ResponseWriter, r *http.Request) {
}
// Move the file in one journaled transaction: a failed destination write
// or source removal must not leave the same room ID in two directories.
- txn := persistence.NewTransaction(filepath.Join(s.dataDir, ".journal"))
+ txn := persistence.NewTransaction(persistence.JournalDir(s.dataDir))
if err := txn.Move(oldPath, newPath); err != nil {
failJSON(w, "plan move: "+err.Error())
return
@@ -1054,7 +1054,7 @@ func (s *AdminServer) handleRoomRename(w http.ResponseWriter, r *http.Request) {
}
// ---- Apply the file changes as one journal transaction. ----
- txn := persistence.NewTransaction(filepath.Join(s.dataDir, ".journal"))
+ txn := persistence.NewTransaction(persistence.JournalDir(s.dataDir))
if err := txn.Move(oldPath, newPath); err != nil {
writeJSONError(w, "plan move: "+err.Error(), http.StatusInternalServerError)
return
@@ -1240,7 +1240,7 @@ func (s *AdminServer) handleRoomSwap(w http.ResponseWriter, r *http.Request) {
// Apply both files in one journaled transaction so a failure cannot leave
// the two rooms half-swapped.
- txn := persistence.NewTransaction(filepath.Join(s.dataDir, ".journal"))
+ txn := persistence.NewTransaction(persistence.JournalDir(s.dataDir))
if err := txn.Replace(aPath, newAContent, 0644); err != nil {
writeJSONError(w, "plan write A: "+err.Error(), http.StatusInternalServerError)
return
@@ -1393,7 +1393,7 @@ func (s *AdminServer) handleResolveDuplicate(w http.ResponseWriter, r *http.Requ
}
// Move + rewrite in one journaled transaction so a failure cannot
// leave the same ID in two directories.
- txn := persistence.NewTransaction(filepath.Join(s.dataDir, ".journal"))
+ txn := persistence.NewTransaction(persistence.JournalDir(s.dataDir))
if err := txn.Move(absPath, newRel); err != nil {
failJSON(w, "plan rename failed: "+err.Error())
return