Fixed #30, validation triggers at a later stage

This commit is contained in:
マリウス 2022-01-11 15:19:48 -05:00
parent 0723ec3379
commit a89946d46b
No known key found for this signature in database
GPG Key ID: 272ED814BF63261F
2 changed files with 10 additions and 4 deletions

View File

@ -93,10 +93,6 @@ func (t *TUI) OpenArticle(article *models.Article, readOnly bool) (models.Articl
newArticle.Body = strings.TrimSpace(content[1])
if valid, err := newArticle.IsValid(); valid == false {
return *article, err
}
return newArticle, nil
}

View File

@ -420,6 +420,11 @@ func(mainscreen *Mainscreen) submitNewArticle(group string) {
return
}
if valid, err := updatedNewArticle.IsValid(); valid == false {
mainscreen.T.ShowErrorModal(err.Error())
return
}
mainscreen.T.ShowModal(
"Do you want to submit this new article?",
map[string]ModalButton{
@ -462,6 +467,11 @@ func(mainscreen *Mainscreen) replyToArticle(article *models.Article) {
return
}
if valid, err := updatedNewArticle.IsValid(); valid == false {
mainscreen.T.ShowErrorModal(err.Error())
return
}
mainscreen.T.ShowModal(
"Do you want to submit this reply?",
map[string]ModalButton{