30 lines
915 B
Go
30 lines
915 B
Go
package email
|
|
|
|
import "github.com/tim/cairnquire/apps/server/internal/collaboration"
|
|
|
|
// CollaborationRenderer adapts email.Render to the collaboration.EmailRenderer
|
|
// interface by converting collaboration.EmailData into email.TemplateData.
|
|
type CollaborationRenderer struct {
|
|
InstanceName string
|
|
}
|
|
|
|
// Render satisfies collaboration.EmailRenderer.
|
|
func (c CollaborationRenderer) Render(kind string, data collaboration.EmailData) (string, string, error) {
|
|
td := TemplateData{
|
|
ActorName: data.ActorName,
|
|
ActorEmail: data.ActorEmail,
|
|
DocumentPath: data.DocumentPath,
|
|
DocumentTitle: data.DocumentTitle,
|
|
CommentBody: data.CommentBody,
|
|
MentionText: data.MentionText,
|
|
ConflictDesc: data.ConflictDesc,
|
|
ViewURL: data.ViewURL,
|
|
UnsubURL: data.UnsubURL,
|
|
InstanceName: c.InstanceName,
|
|
}
|
|
if td.InstanceName == "" {
|
|
td.InstanceName = "Cairnquire"
|
|
}
|
|
return Render(kind, td)
|
|
}
|