1
0

docs: adjust documentation to reflect single-binary deployments

This commit is contained in:
kolaente
2024-02-09 19:09:19 +01:00
parent 11b72765c9
commit 1984527fae
28 changed files with 732 additions and 1226 deletions

View File

@ -18,13 +18,13 @@ Vikunja provides a simple abstraction to send notifications per mail and in the
Each notification has to implement this interface:
{{< highlight golang >}}
```go
type Notification interface {
ToMail() *Mail
ToDB() interface{}
Name() string
}
{{< /highlight >}}
```
Both functions return the formatted messages for mail and database.
@ -35,7 +35,7 @@ For example, if your notification should not be recorded in the database but onl
A list of chainable functions is available to compose a mail:
{{< highlight golang >}}
```go
mail := NewMail().
// The optional sender of the mail message.
From("test@example.com").
@ -54,7 +54,7 @@ mail := NewMail().
Action("The Action", "https://example.com").
// Another line of text.
Line("This should be an outro line").
{{< /highlight >}}
```
If not provided, the `from` field of the mail contains the value configured in [`mailer.fromemail`](https://vikunja.io/docs/config-options/#fromemail).
@ -74,14 +74,14 @@ It takes the name of the notification and the package where the notification wil
Notifiables can receive a notification.
A notifiable is defined with this interface:
{{< highlight golang >}}
```go
type Notifiable interface {
// Should return the email address this notifiable has.
RouteForMail() string
// Should return the id of the notifiable entity
RouteForDB() int64
}
{{< /highlight >}}
```
The `User` type from the `user` package implements this interface.
@ -92,7 +92,7 @@ It takes a notifiable and a notification as input.
For example, the email confirm notification when a new user registers is sent like this:
{{< highlight golang >}}
```go
n := &EmailConfirmNotification{
User: update.User,
IsNew: false,
@ -100,7 +100,7 @@ n := &EmailConfirmNotification{
err = notifications.Notify(update.User, n)
return
{{< /highlight >}}
```
## Testing
@ -110,9 +110,9 @@ If it was called, no mails are being sent and you can instead assert they have b
When testing, you should call the `notifications.Fake()` method in the `TestMain` function of the package you want to test.
This prevents any notifications from being sent and lets you assert a notifications has been sent like this:
{{< highlight golang >}}
```go
notifications.AssertSent(t, &ReminderDueNotification{})
{{< /highlight >}}
```
## Example