fix button in mail
This commit is contained in:
parent
07f08aad55
commit
1921d1aa92
@ -80,6 +80,7 @@
|
||||
<tr>
|
||||
<td colspan="2" style="height: 100%">
|
||||
<a
|
||||
href="https://quiz.pena.digital/results/{{ .QuizID }}"
|
||||
style="
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
@ -155,7 +155,7 @@ func (w *SendToClient) processPendingAnswer(ctx context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
result, err := w.processAnswerWithPrivileges(ctx, quiz.Name, quizConfig, questionsMap, privileges, account, sortedallAnswers, answerContent, answer.CreatedAt)
|
||||
result, err := w.processAnswerWithPrivileges(ctx, quiz.Name, quizConfig, questionsMap, privileges, account, sortedallAnswers, answerContent, answer.CreatedAt, answer.QuizId)
|
||||
fmt.Println("ANS8", err, result, privileges)
|
||||
if err != nil {
|
||||
w.reportError(err, "Error process answer with privileges")
|
||||
@ -174,7 +174,7 @@ func (w *SendToClient) processPendingAnswer(ctx context.Context) {
|
||||
|
||||
func (w *SendToClient) processAnswerWithPrivileges(ctx context.Context, quizName string, quizConfig model.QuizConfig,
|
||||
questionsMap map[uint64]string, privileges []model.ShortPrivilege, account model.Account, allAnswers []model.ResultAnswer,
|
||||
answerContent model.ResultContent, answerTime time.Time) (bool, error) {
|
||||
answerContent model.ResultContent, answerTime time.Time, quizID uint64) (bool, error) {
|
||||
|
||||
err := w.notificationCustomer(account, privileges)
|
||||
fmt.Println("ANS81", err)
|
||||
@ -183,7 +183,7 @@ func (w *SendToClient) processAnswerWithPrivileges(ctx context.Context, quizName
|
||||
}
|
||||
|
||||
if wctools.HasUnlimitedPrivilege(privileges) {
|
||||
err := w.ProcessMessageToClient(quizConfig, questionsMap, account, allAnswers, answerContent, answerTime)
|
||||
err := w.ProcessMessageToClient(quizConfig, questionsMap, account, allAnswers, answerContent, answerTime, quizID)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
@ -191,7 +191,7 @@ func (w *SendToClient) processAnswerWithPrivileges(ctx context.Context, quizName
|
||||
}
|
||||
privilege := wctools.HasQuizCntPrivilege(privileges)
|
||||
if privilege != nil {
|
||||
err := w.ProcessMessageToClient(quizConfig, questionsMap, account, allAnswers, answerContent, answerTime)
|
||||
err := w.ProcessMessageToClient(quizConfig, questionsMap, account, allAnswers, answerContent, answerTime, quizID)
|
||||
fmt.Println("PMC", err)
|
||||
if err != nil {
|
||||
return true, err
|
||||
@ -306,7 +306,7 @@ func (w *SendToClient) notificationCustomer(account model.Account, privileges []
|
||||
}
|
||||
|
||||
// сделал экспортируемым для теста
|
||||
func (w *SendToClient) ProcessMessageToClient(quizConfig model.QuizConfig, questionsMap map[uint64]string, account model.Account, allAnswers []model.ResultAnswer, answerContent model.ResultContent, answerTime time.Time) error {
|
||||
func (w *SendToClient) ProcessMessageToClient(quizConfig model.QuizConfig, questionsMap map[uint64]string, account model.Account, allAnswers []model.ResultAnswer, answerContent model.ResultContent, answerTime time.Time, quizID uint64) error {
|
||||
theme := quizConfig.Mailing.Theme
|
||||
quizConfig.Mailing.Theme = quizConfig.Mailing.Reply
|
||||
|
||||
@ -315,6 +315,7 @@ func (w *SendToClient) ProcessMessageToClient(quizConfig model.QuizConfig, quest
|
||||
AnswerContent: answerContent,
|
||||
AllAnswers: allAnswers,
|
||||
QuestionsMap: questionsMap,
|
||||
QuizID: quizID,
|
||||
}
|
||||
|
||||
dayOfWeek := wctools.DaysOfWeek[answerTime.Format("Monday")]
|
||||
|
@ -26,6 +26,7 @@ type Client struct {
|
||||
|
||||
type EmailTemplateData struct {
|
||||
QuizConfig model.ResultInfo
|
||||
QuizID uint64
|
||||
AnswerContent model.ResultContent
|
||||
AllAnswers []model.ResultAnswer
|
||||
QuestionsMap map[uint64]string
|
||||
@ -123,6 +124,7 @@ func generateTextFromTemplate(data EmailTemplateData, tpl string) (string, error
|
||||
AllAnswers: data.AllAnswers,
|
||||
QuestionsMap: data.QuestionsMap,
|
||||
AnswerTime: data.AnswerTime,
|
||||
QuizID: data.QuizID,
|
||||
}); err != nil {
|
||||
return "", fmt.Errorf("error executing template: %w", err)
|
||||
}
|
||||
|
@ -99,6 +99,7 @@ func sanitizeHTMLData(data EmailTemplateData) EmailTemplateData {
|
||||
AllAnswers: stripHTMLResultAnswers(data.AllAnswers),
|
||||
QuestionsMap: stripHTMLResultMap(data.QuestionsMap),
|
||||
AnswerTime: StripHTML(data.AnswerTime),
|
||||
QuizID: data.QuizID,
|
||||
}
|
||||
return sanitized
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user