Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve automated paste tense conversion of actions #22

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions gitlab-webhook.go
Expand Up @@ -188,11 +188,11 @@ func handleIssueEvent(payload interface{}, room mautrix.Room) {
action := data.ObjectAttributes.Action
if action == "update" || len(action) == 0 {
return
} else if !strings.HasSuffix(action, "e") {
action += "e"
} else if !strings.HasSuffix(action, "ed") {
action += "ed"
}
room.SendfHTML(
"[%[1]s/%[2]s] %[3]s %[4]sd %[5]sissue <a href='%[6]s'>%[7]s (#%[8]d)</a>",
"[%[1]s/%[2]s] %[3]s %[4]s %[5]sissue <a href='%[6]s'>%[7]s (#%[8]d)</a>",
data.Project.Namespace,
data.Project.Name,
data.User.Name,
Expand All @@ -209,11 +209,11 @@ func handleMergeRequestEvent(payload interface{}, room mautrix.Room) {
action := data.ObjectAttributes.Action
if action == "update" {
return
} else if !strings.HasSuffix(action, "e") {
action += "e"
} else if !strings.HasSuffix(action, "ed") {
action += "ed"
}
room.SendfHTML(
"[%[1]s/%[2]s] %[3]s %[4]sd merge request <a href='%[5]s'>%[6]s (!%[7]d)</a>",
"[%[1]s/%[2]s] %[3]s %[4]s merge request <a href='%[5]s'>%[6]s (!%[7]d)</a>",
data.ObjectAttributes.Target.Namespace,
data.ObjectAttributes.Target.Name,
data.User.Name,
Expand Down Expand Up @@ -291,11 +291,11 @@ func handleWikiPageEvent(payload interface{}, room mautrix.Room) {

action := data.ObjectAttributes.Action

if !strings.HasSuffix(action, "e") {
action += "e"
if !strings.HasSuffix(action, "ed") {
action += "ed"
}
room.SendfHTML(
"[%[1]s/%[2]s] %[3]s %[4]sd page on wiki <a href='%[5]s'>%[6]s (#%[7]d)</a>",
"[%[1]s/%[2]s] %[3]s %[4]s page on wiki <a href='%[5]s'>%[6]s (#%[7]d)</a>",
data.Project.Namespace,
data.Project.Name,
data.User.Name,
Expand Down