Skip to content

Commit 4d08efc

Browse files
committed
Apply %mail% and %user% substitutions to all commit messages, add page %ns% substitution
1 parent f8541e5 commit 4d08efc

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

action/editcommit.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,12 @@ private function isIgnored($filePath)
9797
private function commitFile($filePath, $message)
9898
{
9999
if (!$this->isIgnored($filePath)) {
100+
$message = str_replace(
101+
['%user%', '%mail%', '\n', '\t'],
102+
[$this->getAuthor(), $this->getAuthorMail(), "\n", "\t"],
103+
$message
104+
);
105+
100106
try {
101107
$repo = $this->initRepo();
102108

@@ -232,8 +238,8 @@ public function handleMediaDeletion(Event &$event, $param)
232238
$mediaName = $event->data['name'];
233239

234240
$message = str_replace(
235-
['%media%', '%user%'],
236-
[$mediaName, $this->getAuthor()],
241+
['%media%'],
242+
[$mediaName],
237243
$this->getConf('commitMediaMsgDel')
238244
);
239245

@@ -247,8 +253,8 @@ public function handleMediaUpload(Event &$event, $param)
247253
$mediaName = $event->data[2];
248254

249255
$message = str_replace(
250-
['%media%', '%user%'],
251-
[$mediaName, $this->getAuthor()],
256+
['%media%'],
257+
[$mediaName],
252258
$this->getConf('commitMediaMsg')
253259
);
254260

@@ -267,6 +273,7 @@ public function handleIOWikiPageWrite(Event &$event, $param)
267273
if (!$rev) {
268274
$pagePath = $event->data[0][0];
269275
$pageName = $event->data[2];
276+
$pageNs = $event->data[1];
270277
$pageContent = $event->data[0][1];
271278

272279
// get the summary directly from the form input
@@ -288,8 +295,8 @@ public function handleIOWikiPageWrite(Event &$event, $param)
288295
}
289296

290297
$message = str_replace(
291-
['%page%', '%summary%', '%user%'],
292-
[$pageName, $editSummary, $this->getAuthor()],
298+
['%page%', '%summary%', '%ns%'],
299+
[$pageName, $editSummary, $pageNs],
293300
$msgTemplate
294301
);
295302

0 commit comments

Comments
 (0)