Skip to content

Commit

Permalink
fix: update field for memo pr (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
quanghuynguyen1902 authored Jul 10, 2024
1 parent 807d5e4 commit 8de5cfa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
5 changes: 3 additions & 2 deletions pkg/discord/view/memo/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

var (
memoCategoryList = []string{memoCategoryFleeting, memoCategoryLiterature, memoCategoryEarn, memoCategoryOthers}
githubUrl = "https://github.com"
)

const (
Expand Down Expand Up @@ -118,11 +119,11 @@ func (v *Memo) ListMemoOpenPullRequest(original *model.DiscordMessage, memoPr mo
prs := memoPr[repo]

for _, pr := range prs {
author := fmt.Sprintf("[%s](%s)", pr.GithubUserName, pr.GithubUserLink)
author := fmt.Sprintf("[%s](%s/%s)", pr.GithubUserName, githubUrl, pr.GithubUserName)
if pr.DiscordId != "" {
author = fmt.Sprintf("<@%s>", pr.DiscordId)
}
content += fmt.Sprintf("∟ %s [[#%d](%s)] %s - %s \n", stringutils.ConvertToTimeAgo(pr.Timestamp), pr.Number, pr.GithubLink, pr.Message, author)
content += fmt.Sprintf("∟ %s [[#%d](%s)] %s - %s \n", stringutils.ConvertToTimeAgo(pr.Timestamp), pr.Number, pr.Url, pr.Title, author)
}

content += "\n"
Expand Down
13 changes: 6 additions & 7 deletions pkg/model/memos.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@ type MemoLogsResponse struct {
}

type MemoPullRequest struct {
Number int `json:"Number"`
Message string `json:"Message"`
DiscordId string `json:"DiscordId"`
GithubUserName string `json:"GithubUserName"`
GithubUserLink string `json:"GithubUserLink"`
GithubLink string `json:"GithubLink"`
Timestamp time.Time `json:"Timestamp"`
Number int `json:"number"`
Title string `json:"title"`
DiscordId string `json:"discord_id"`
GithubUserName string `json:"github_user_name"`
Url string `json:"url"`
Timestamp time.Time `json:"timestamp"`
}

type MemoRepoWithPullRequest map[string][]MemoPullRequest
Expand Down

0 comments on commit 8de5cfa

Please sign in to comment.