Fix delete behaviour
This commit is contained in:
parent
0498aadcf2
commit
a955c49373
2 changed files with 15 additions and 6 deletions
|
|
@ -136,8 +136,9 @@ func (ns *NoteStore) Add(note *Note, user string) {
|
|||
ns.notes[user][note] = true
|
||||
}
|
||||
|
||||
func (ns *NoteStore) Del(note *Note, user string) {
|
||||
func (ns *NoteStore) Del(note *Note, user string) error {
|
||||
delete(ns.notes[user], note)
|
||||
return note.Delete()
|
||||
}
|
||||
|
||||
func (ns *NoteStore) UserTags(user string) []string {
|
||||
|
|
@ -340,8 +341,8 @@ func (n *Note) DelViewer(viewer string) {
|
|||
delete(n.Viewers, viewer)
|
||||
}
|
||||
|
||||
func DeleteNote(uid string) error {
|
||||
filename := filepath.Join(conf.Conf.NotesDir, fmtPath(uid))
|
||||
func (n *Note) Delete() error {
|
||||
filename := filepath.Join(conf.Conf.NotesDir, fmtPath(n.Uid))
|
||||
return os.Remove(filename)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue