Changeset 0.23.2 (#155)
This commit is contained in:
@@ -376,6 +376,46 @@ func main() {
|
||||
protected.GET("/channels/:id", channels.GetChannel)
|
||||
protected.PUT("/channels/:id", channels.UpdateChannel)
|
||||
protected.DELETE("/channels/:id", channels.DeleteChannel)
|
||||
protected.POST("/channels/:id/mark-read", channels.MarkRead)
|
||||
|
||||
// Typing indicator broadcast (v0.23.2)
|
||||
protected.POST("/channels/:id/typing", func(c *gin.Context) {
|
||||
userID := c.GetString("user_id")
|
||||
channelID := c.Param("id")
|
||||
// Resolve display name
|
||||
var displayName string
|
||||
_ = database.DB.QueryRow(database.Q(`
|
||||
SELECT COALESCE(display_name, username) FROM users WHERE id = $1
|
||||
`), userID).Scan(&displayName)
|
||||
if displayName == "" {
|
||||
displayName = userID[:8]
|
||||
}
|
||||
// Broadcast to other user participants
|
||||
pRows, err := database.DB.Query(database.Q(`
|
||||
SELECT participant_id FROM channel_participants
|
||||
WHERE channel_id = $1 AND participant_type = 'user' AND participant_id != $2
|
||||
`), channelID, userID)
|
||||
if err == nil {
|
||||
defer pRows.Close()
|
||||
payload, _ := json.Marshal(map[string]any{
|
||||
"channel_id": channelID,
|
||||
"user_id": userID,
|
||||
"display_name": displayName,
|
||||
})
|
||||
evt := events.Event{
|
||||
Label: "typing.user",
|
||||
Payload: payload,
|
||||
Ts: time.Now().UnixMilli(),
|
||||
}
|
||||
for pRows.Next() {
|
||||
var pid string
|
||||
if pRows.Scan(&pid) == nil {
|
||||
hub.SendToUser(pid, evt)
|
||||
}
|
||||
}
|
||||
}
|
||||
c.JSON(200, gin.H{"ok": true})
|
||||
})
|
||||
|
||||
// Chat Folders (v0.23.1)
|
||||
folders := handlers.NewFolderHandler()
|
||||
@@ -388,6 +428,19 @@ func main() {
|
||||
protected.POST("/presence/heartbeat", handlers.PresenceHeartbeat)
|
||||
protected.GET("/presence", handlers.PresenceQuery)
|
||||
|
||||
// User search (v0.23.2 — DM user picker)
|
||||
protected.GET("/users/search", handlers.SearchUsers)
|
||||
|
||||
// Persona groups (v0.23.2 — roster templates for group chats)
|
||||
pgH := handlers.NewPersonaGroupHandler()
|
||||
protected.GET("/persona-groups", pgH.List)
|
||||
protected.POST("/persona-groups", pgH.Create)
|
||||
protected.GET("/persona-groups/:id", pgH.Get)
|
||||
protected.PUT("/persona-groups/:id", pgH.Update)
|
||||
protected.DELETE("/persona-groups/:id", pgH.Delete)
|
||||
protected.POST("/persona-groups/:id/members", pgH.AddMember)
|
||||
protected.DELETE("/persona-groups/:id/members/:memberId", pgH.RemoveMember)
|
||||
|
||||
// Channel models (v0.20.0 — multi-model @mention routing)
|
||||
chModelH := handlers.NewChannelModelHandler(stores)
|
||||
protected.GET("/channels/:id/models", chModelH.List)
|
||||
@@ -802,6 +855,10 @@ func main() {
|
||||
admin.POST("/storage/cleanup", fileAdm.CleanupOrphans)
|
||||
admin.GET("/storage/extraction", fileAdm.ExtractionStatus)
|
||||
|
||||
// Archived channels (admin — v0.23.2)
|
||||
admin.GET("/channels/archived", adm.ListArchivedChannels)
|
||||
admin.DELETE("/channels/:id/purge", adm.PurgeChannel)
|
||||
|
||||
// Extensions (admin)
|
||||
extAdm := handlers.NewExtensionHandler(stores)
|
||||
admin.GET("/extensions", extAdm.AdminListExtensions)
|
||||
|
||||
Reference in New Issue
Block a user