bugfixes
Former-commit-id: 38f7bdc4de8a29be11376e2321aaedb027b84a57 [formerly 72daa72c1b48182002bf81ac374b54dad2bae465] [formerly 8498a21191a043432e0a857cbc4aae49761bfdbf [formerly 2ad805d793
]]
Former-commit-id: 068d502148b08cfd8dc627739847888f018f4417 [formerly 882e3aff3891329a62374c448e839ba41edebb45]
Former-commit-id: 7b71062e2c6e86c5e1ce36daaeb265972c941ca5
pull/726/head
parent
7de22b53b8
commit
037efc2eb8
|
@ -386,7 +386,8 @@ table tr>*:last-child {
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapsible > label i {
|
.collapsible > label i {
|
||||||
transition: .2s ease transform
|
transition: .2s ease transform;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.collapsible .collapse {
|
.collapsible .collapse {
|
||||||
|
|
|
@ -82,6 +82,21 @@ type FileManager struct {
|
||||||
NewFS FSBuilder
|
NewFS FSBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var commandEvents = []string{
|
||||||
|
"before_save",
|
||||||
|
"after_save",
|
||||||
|
"before_publish",
|
||||||
|
"after_publish",
|
||||||
|
"before_copy",
|
||||||
|
"after_copy",
|
||||||
|
"before_rename",
|
||||||
|
"after_rename",
|
||||||
|
"before_upload",
|
||||||
|
"after_upload",
|
||||||
|
"before_delete",
|
||||||
|
"after_delete",
|
||||||
|
}
|
||||||
|
|
||||||
// Command is a command function.
|
// Command is a command function.
|
||||||
type Command func(r *http.Request, m *FileManager, u *User) error
|
type Command func(r *http.Request, m *FileManager, u *User) error
|
||||||
|
|
||||||
|
@ -130,24 +145,24 @@ func (m *FileManager) Setup() error {
|
||||||
err = m.Store.Config.Get("commands", &m.Commands)
|
err = m.Store.Config.Get("commands", &m.Commands)
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
// ADD handlers to commands if dont exist
|
// Add hypothetically new command handlers.
|
||||||
|
for _, command := range commandEvents {
|
||||||
|
if _, ok := m.Commands[command]; ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
m.Commands[command] = []string{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil && err == ErrNotExist {
|
if err != nil && err == ErrNotExist {
|
||||||
m.Commands = map[string][]string{
|
m.Commands = map[string][]string{}
|
||||||
"before_save": {},
|
|
||||||
"after_save": {},
|
// Initialize the command handlers.
|
||||||
"before_publish": {},
|
for _, command := range commandEvents {
|
||||||
"after_publish": {},
|
m.Commands[command] = []string{}
|
||||||
"before_copy": {},
|
|
||||||
"after_copy": {},
|
|
||||||
"before_rename": {},
|
|
||||||
"after_rename": {},
|
|
||||||
"before_upload": {},
|
|
||||||
"after_upload": {},
|
|
||||||
"before_delete": {},
|
|
||||||
"after_delete": {},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = m.Store.Config.Save("commands", m.Commands)
|
err = m.Store.Config.Save("commands", m.Commands)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
c249fdbec733fcd4aefc255262596bee379c471a
|
02569a5e91d6d6dcfa2357521c46c159f5edd5c4
|
Loading…
Reference in New Issue