summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/entry/entry.go5
-rw-r--r--internal/timestamp/timestamp.go1
2 files changed, 3 insertions, 3 deletions
diff --git a/internal/entry/entry.go b/internal/entry/entry.go
index e1d9696..b8752e3 100644
--- a/internal/entry/entry.go
+++ b/internal/entry/entry.go
@@ -99,9 +99,8 @@ func (e *Entry) MarkPosted() error {
if e.State == Posted {
return errors.New("entry is already posted")
}
- // TODO: Also update the timestamp to reflect the posting time in the file path.
- // Write a timestamp.Update() function for this.
- if err := os.Rename(e.Path, strings.TrimSuffix(e.Path, ".queued")+".posted"); err != nil {
+ newPath := timestamp.UpdateInFilename(strings.TrimSuffix(e.Path, ".queued")+".posted", -2)
+ if err := os.Rename(e.Path, newPath); err != nil {
return err
}
e.State = Posted
diff --git a/internal/timestamp/timestamp.go b/internal/timestamp/timestamp.go
index 425bc2f..fb1fe50 100644
--- a/internal/timestamp/timestamp.go
+++ b/internal/timestamp/timestamp.go
@@ -34,6 +34,7 @@ func OldestValidTime() time.Time {
return oldestValidTime
}
+// TODO: Maybe make this safer?
func UpdateInFilename(filename string, rIndex int) string {
parts := strings.Split(filename, ".")
parts[len(parts)+rIndex] = Now()