Skip to content

Commit cd81c42

Browse files
committed
Link PRs in changelog
1 parent 8e1dd2b commit cd81c42

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "insomnia",
4-
"version": "5.4.0",
4+
"version": "5.5.2",
55
"productName": "Insomnia",
66
"longName": "Insomnia REST Client",
77
"description": "Debug APIs like a human, not a robot",

app/ui/components/modals/changelog-modal.js

+21-3
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,30 @@ class ChangelogModal extends PureComponent {
9797
];
9898
}
9999

100+
const printThing = (text, key) => {
101+
const match = text.match(/\(PR:(\d+)(:([^)]+))?\)/);
102+
let link = null;
103+
if (match) {
104+
const prNumber = match[1];
105+
const user = match[3] || '';
106+
text = text.replace(match[0], '');
107+
link = (
108+
<Link href={`https://github.com/getinsomnia/insomnia/pull/${prNumber}`}>
109+
#{prNumber}
110+
{user ? ` by ${user}` : null}
111+
</Link>
112+
);
113+
}
114+
115+
return <li key={key}>{text}{link && '('}{link}{link && ')'}</li>;
116+
};
117+
100118
if (change.major && change.major.length) {
101119
html = [
102120
...html,
103121
<h3 key={`major.${i}`}>Major</h3>,
104122
<ul key={`major.${i}.list`}>
105-
{change.major.map((text, i) => <li key={i}>{text}</li>)}
123+
{change.major.map(printThing)}
106124
</ul>
107125
];
108126
}
@@ -112,7 +130,7 @@ class ChangelogModal extends PureComponent {
112130
...html,
113131
<h3 key={`fixes.${i}`}>Bug Fixes</h3>,
114132
<ul key={`fixes.${i}.list`}>
115-
{change.fixes.map((text, j) => <li key={j}>{text}</li>)}
133+
{change.fixes.map(printThing)}
116134
</ul>
117135
];
118136
}
@@ -122,7 +140,7 @@ class ChangelogModal extends PureComponent {
122140
...html,
123141
<h3 key={`minor.${i}`}>Minor</h3>,
124142
<ul key={`minor.${i}.list`}>
125-
{change.minor.map((text, i) => <li key={i}>{text}</li>)}
143+
{change.minor.map(printThing)}
126144
</ul>
127145
];
128146
}

0 commit comments

Comments
 (0)