aboutsummaryrefslogtreecommitdiffstats
path: root/commands/commands.go
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2023-05-06 11:30:48 +0200
committerRobin Jarry <robin@jarry.cc>2023-05-16 17:12:00 +0200
commit30c1a30168dfff8ca5eecb8d0fa42ab4b638f79d (patch)
tree97d177a8e399ed7ad7f107b85df1cd4d246e50ff /commands/commands.go
parent6b6aaf3ae131971d05ab3f849ea3db14c6a6e055 (diff)
downloadaerc-30c1a30168dfff8ca5eecb8d0fa42ab4b638f79d.tar.gz
templates: use template interface consistently
Use the template interface consistently. Before, we have exported the state.TemplateData struct and used it in most places instead of the models.TemplateData interface. This lead to some inconsistencies, i.e. Role() has been defined on the exported struct but not on the interface. Unexport the state.TemplateData struct, add a DataSetter interface to set the data needed for the template data and call the Data() method which returns a models.TemplateData interface when the template data is needed. Signed-off-by: Koni Marti <koni.marti@gmail.com> Acked-by: Tim Culverhouse <tim@timculverhouse.com>
Diffstat (limited to 'commands/commands.go')
-rw-r--r--commands/commands.go5
1 files changed, 2 insertions, 3 deletions
diff --git a/commands/commands.go b/commands/commands.go
index 7dfd183b..59f87321 100644
--- a/commands/commands.go
+++ b/commands/commands.go
@@ -98,8 +98,7 @@ func templateData(
msg, _ = acct.SelectedMessage()
}
- var data state.TemplateData
-
+ data := state.NewDataSetter()
data.SetAccount(cfg)
data.SetFolder(folder)
data.SetInfo(msg, 0, false)
@@ -109,7 +108,7 @@ func templateData(
})
}
- return &data
+ return data.Data()
}
func (cmds *Commands) ExecuteCommand(