Add restore functionality for archived messages

- Added `RestoreMessageHandler` and route at `/account/messages/restore`
- Updated `users_messages` table to support `archived_at` reset
- Added restore button to archived messages template
- Ensures archived messages can be moved back into inbox
This commit is contained in:
2025-04-02 22:18:02 +01:00
parent dd83081271
commit db5352bc9c
8 changed files with 146 additions and 25 deletions

View File

@@ -16,3 +16,11 @@ func GetTotalPages(db *sql.DB, tableName, whereClause string, args []interface{}
}
return totalPages, totalCount
}
func MakePageRange(current, total int) []int {
var pages []int
for i := 1; i <= total; i++ {
pages = append(pages, i)
}
return pages
}

View File

@@ -44,6 +44,7 @@ func TemplateFuncs() template.FuncMap {
},
"mul": func(a, b int) int { return a * b },
"add": func(a, b int) int { return a + b },
"sub": func(a, b int) int { return a - b },
"min": func(a, b int) int {
if a < b {
return a
@@ -66,6 +67,7 @@ func TemplateFuncs() template.FuncMap {
}
return s[:max] + "..."
},
"PageRange": PageRange,
}
}
@@ -115,3 +117,11 @@ func rangeClass(n int) string {
return "50-plus"
}
}
func PageRange(current, total int) []int {
var pages []int
for i := 1; i <= total; i++ {
pages = append(pages, i)
}
return pages
}