Repository navigation
Add prevent-pr-commit-link-loss feature - #3085
Conversation
|
Thank you for the PR! You can simplify this to a single |
|
I'll try and implement it with delegate, never used it before 👍 |
|
Update @fregante , let me know what you think. Cheers. |
fregante
left a comment
There was a problem hiding this comment.
Looks much shorter! Here’s a few more notes
….tsx Co-authored-by: Fregante <[email protected]>
….tsx Co-authored-by: Fregante <[email protected]>
….tsx Co-authored-by: Fregante <[email protected]>
….tsx Co-authored-by: Fregante <[email protected]>
|
@fregante Thanks a lot for the help. Pushed all suggestions and a few tests. |
….tsx Co-authored-by: Fregante <[email protected]>
Co-authored-by: Fregante <[email protected]>
|
On further thought, this really cannot be done automatically. Proper replacement requires a Markdown parser and we can't import that. If you can, I suggest reimplementing it as an actionable warning instead, so the user can make an informed decision. Here's the code for this alert, but it needs more work: select('.form-actions').prepend(
<div class="flash flash-warn mb-2">
<AlertIcon /> Your PR Commit link may be <a href="https://github.com/sindresorhus/refined-github/issues/2327">misinterpreted by GitHub.</a>
<button type="button" class="btn btn-sm primary flash-action">Fix link</button>
</div>
); |
|
Thanks for all the help @fregante Is there anything pending? |
|
@max-arias this only works for comments. Can you make sure this also works when opening an issue or PR? |
|
@max-arias I once started working on it and dont have time to continue. @@ -27,7 +27,11 @@ function updateUI(event: delegate.Event<InputEvent, HTMLTextAreaElement>): void
const field = event.delegateTarget;
if (prCommitRegex.test(field.value)) {
- select('.form-actions', field.form!)!.prepend(getUI(field));
+ if (pageDetect.hasComments()) {
+ select('.form-actions', field.form!)!.prepend(getUI(field));
+ } else {
+ select('#new_issue .flex-items-center, #new_pull_request .flex-justify-end')!.before(<div className="form-actions">
{getUI(field)} </div>);
+ }
} else {
getUI(field).remove();
}
@@ -44,7 +48,7 @@ features.add({
screenshot: 'https://user-images.githubusercontent.com/1402241/82131169-93fd5180-97d2-11ea-9695-97051c55091f.gif'
}, {
include: [
- pageDetect.hasComments
+ pageDetect.hasRichTextEditor
],
init
}); |
|
Thanks @yakov116 . Little busy during the week, I'll see if I can put a few hours this weekend. Cheers. |



Closes: #2327
Note: I had to rename the URL to something other than the URL, otherwise Github replaces the URL anyways with the commit URL in the markdown 🤷♂️ .
IssueHunt Summary
Referenced issues
This pull request has been submitted to: