Page MenuHomephabricator

Parse the Phabricator links in JSS 9 summaries
ClosedPublic

Authored by kerberizer on Nov 8 2018, 12:45 AM.

Details

Summary

When the synchronization script updates pages on the wiki, it records the respective commit from Phabricator in the edit summary. Since these links are external, MW doesn't convert them to working hyperlinks, which makes following them somewhat tedious. Keeping a separate log page on the wiki just for this reason seems like an overkill and waste of resources, when we could simply utilize JS to make those links active. The current format of the summary is [[User:username|username]] | Phabricator URL | Commit message. The proposed code converts this to [[User:username|username]]: <a href="Phabricator URL" target="_blank">Commit message</a>. We check for correct action ("history") and namespace and also parse only the history entries by JSS 9 to maximize efficiency.

Test Plan

Diff Detail

Repository
rUI JS/CSS User Interface
Branch
enh/parse-ph-links-in-history
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 9
Build 9: arc lint + arc unit

Event Timeline

kerberizer requested review of this revision.Nov 8 2018, 12:45 AM
kerberizer created this revision.
Harbormaster completed remote builds in B9: Diff 12.Nov 8 2018, 12:46 AM
kerberizer updated this revision to Diff 13.Nov 8 2018, 12:54 AM

Style and comment

kerberizer updated this revision to Diff 14.Nov 8 2018, 1:01 AM

Less ambiguous var name

Harbormaster completed remote builds in B11: Diff 14.Nov 8 2018, 1:01 AM
kerberizer updated this revision to Diff 15.Nov 8 2018, 7:42 AM

var comment is actually a jQuery object to let's use the common $var notation.

Harbormaster completed remote builds in B12: Diff 15.Nov 8 2018, 7:42 AM
kerberizer edited the test plan for this revision. (Show Details)Nov 8 2018, 7:44 AM
kerberizer retitled this revision from Parse the Phabricator links in JSS 9 summaries. to Parse the Phabricator links in JSS 9 summaries.
kerberizer updated this revision to Diff 16.Nov 8 2018, 11:14 AM

Enclose the code nicely in anon func that gets called. Also, because this gets the nesting rather deep, invert the "should we run?" condition test and immediately return from the function if it isn't satisfied.

kerberizer edited the test plan for this revision. (Show Details)Nov 8 2018, 11:17 AM
kerberizer updated this revision to Diff 17.Nov 8 2018, 11:18 AM

Eh, we actually do use mw.

Borislav added inline comments.Nov 8 2018, 4:52 PM
Gadget-ParsePhabLinks.js
4

Като още една микрооптимизация, if-а може да се измести един ред по-нагоре, извън функцията на jQuery/$.

kerberizer updated this revision to Diff 18.Nov 8 2018, 5:36 PM

Addressed review suggestions; further style cleanup.

Harbormaster completed remote builds in B15: Diff 18.Nov 8 2018, 5:36 PM
kerberizer marked an inline comment as done.Nov 8 2018, 5:38 PM

Мерси, Боби! :)

Borislav accepted this revision.Nov 8 2018, 6:07 PM
This revision is now accepted and ready to land.Nov 8 2018, 6:07 PM
This revision was automatically updated to reflect the committed changes.