Use customer names in UI and tickets
This commit is contained in:
parent
0df41e08a0
commit
b187ee2257
|
|
@ -233,6 +233,26 @@ func TestStripCommentFooter_MultipleFooters(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestStripCommentFooter_SubmittedByNameAndEmail(t *testing.T) {
|
||||
body, attribution := StripCommentFooter("Description\n\n---\n*Submitted by: John Doe <user@example.com>*")
|
||||
if body != "Description" {
|
||||
t.Errorf("expected body %q, got %q", "Description", body)
|
||||
}
|
||||
if attribution != "John Doe <user@example.com>" {
|
||||
t.Errorf("expected attribution %q, got %q", "John Doe <user@example.com>", attribution)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStripCommentFooter_CustomerCommentByNameAndEmail(t *testing.T) {
|
||||
body, attribution := StripCommentFooter("Reply\n\n---\n*Customer comment by: Alice Smith <alice@corp.com>*")
|
||||
if body != "Reply" {
|
||||
t.Errorf("expected body %q, got %q", "Reply", body)
|
||||
}
|
||||
if attribution != "Alice Smith <alice@corp.com>" {
|
||||
t.Errorf("expected attribution %q, got %q", "Alice Smith <alice@corp.com>", attribution)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStripCommentFooter_MarkdownHorizontalRule(t *testing.T) {
|
||||
input := "Text\n\n---\n\nMore text"
|
||||
body, email := StripCommentFooter(input)
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ func (h *TicketHandler) Create(c *gin.Context) {
|
|||
|
||||
issue, err := h.deps.ForgejoClient.CreateIssue(repo.ForgejoOwner, repo.ForgejoRepo, forgejo.CreateIssueRequest{
|
||||
Title: title,
|
||||
Body: description + "\n\n---\n*Submitted by: " + user.Email + "*",
|
||||
Body: description + "\n\n---\n*Submitted by: " + user.Name + " <" + user.Email + ">*",
|
||||
Labels: labelIDs,
|
||||
})
|
||||
if err != nil {
|
||||
|
|
@ -449,7 +449,7 @@ func (h *TicketHandler) AddComment(c *gin.Context) {
|
|||
}
|
||||
|
||||
comment, err := h.deps.ForgejoClient.CreateComment(repo.ForgejoOwner, repo.ForgejoRepo, ticket.ForgejoIssueNumber, forgejo.CreateCommentRequest{
|
||||
Body: commentBody + "\n\n---\n*Customer comment by: " + user.Email + "*",
|
||||
Body: commentBody + "\n\n---\n*Customer comment by: " + user.Name + " <" + user.Email + ">*",
|
||||
})
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("forgejo create comment error")
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
</div>
|
||||
<p class="mt-1 text-sm text-gray-500">
|
||||
{{if .Repo}}{{.Repo.Name}} · {{end}}
|
||||
{{if .User}}by {{.User.Email}} · {{end}}
|
||||
{{if .User}}by {{.User.Name}} <{{.User.Email}}> · {{end}}
|
||||
Created {{formatDate .Ticket.CreatedAt}}
|
||||
{{if .Ticket.ForgejoIssueNumber}} · Forgejo #{{.Ticket.ForgejoIssueNumber}}{{end}}
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
<a href="/tickets/{{.ID}}" class="text-sm font-medium text-blue-600 hover:text-blue-500">{{.Title}}</a>
|
||||
</div>
|
||||
</td>
|
||||
<td class="px-4 py-3 text-sm text-gray-500">{{.UserEmail}}</td>
|
||||
<td class="px-4 py-3 text-sm text-gray-500">{{.UserName}}</td>
|
||||
<td class="px-4 py-3 text-sm text-gray-500">{{.RepoName}}</td>
|
||||
<td class="px-4 py-3">{{if .Priority}}{{priorityBadge .Priority}}{{end}}</td>
|
||||
<td class="px-4 py-3">{{statusBadge (print .Status)}}</td>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
{{if .User}}
|
||||
<a href="/tickets" class="text-sm font-medium text-gray-700 hover:text-gray-900">My Tickets</a>
|
||||
<a href="/tickets/new" class="text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 px-3 py-1.5 rounded-md">New Ticket</a>
|
||||
<span class="text-sm text-gray-500">{{.User.Email}}</span>
|
||||
<span class="text-sm text-gray-500">{{.User.Name}}</span>
|
||||
<form method="POST" action="/logout" class="inline">
|
||||
<input type="hidden" name="gorilla.csrf.Token" value="{{.CSRFToken}}">
|
||||
<button type="submit" class="text-sm font-medium text-gray-500 hover:text-gray-700">Logout</button>
|
||||
|
|
|
|||
Loading…
Reference in New Issue