-
Notifications
You must be signed in to change notification settings - Fork 4
Rewrite of CommentTracker #9
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
base: master
Are you sure you want to change the base?
Conversation
ab1bcd9 to
3a7a533
Compare
|
Wow! This is very cool. Love most things here, though I'll probably want to tweak the eslint rules. But I'm okay with everything else. I just merged several pull requests that add some functionality from @alexbt which did a bunch of things that you will want to pull in
So it would be great not to lose that work. Also, my team basically made this to track when new comments come in on old threads, so I can't merge if you feel we need to keep things resolved when a new comment comes in... Perhaps could be an option to turn that off? (With it defaulting to on) This is so much work! Thank you so much for doing all of this! Its incredible. I know well the pains of getting Firefox extensions to work too, and it sounds like you put a lot of effort in. Just a few more tweaks and we can run with it. Maybe one day I can write tests for this... sigh |
This commit temporarily reverts the contributions made by @alexbt between Jan 25, 2017 and Oct 11, 2017. Reason: to merge the significant refactoring of the codebase made in: benbernard#9 The contributions made by @alexbt will be restored on top of the refactoring commits. The following is a list of the commits that have been reverted: df04f70 Bump version 11677eb Merge pull request benbernard#8 from alexbt/fix-empty-unresolved 45a7834 Track unresolved comments with Map 999adab Merge pull request benbernard#7 from alexbt/unresolved-files-bottom 30068dd Add unresolved comments at bottom of files tab f822008 Update version number 5af02ab Merge pull request benbernard#6 from alexbt/options-style ee5528a Merge pull request benbernard#5 from alexbt/files-tab 82a1975 Merge pull request benbernard#4 from alexbt/unresolved-bottom 64bcd6a Use chrome style options page 519c5e2 Display unresolved comments at the bottom 42fe47c Load thread comments from the 'files' tab
This commit temporarily reverts the contributions made by @alexbt between Jan 25, 2017 and Oct 11, 2017. Reason: to merge the significant refactoring of the codebase made in: benbernard#9 The contributions made by @alexbt will be restored on top of the refactoring commits. The following is a list of the commits that have been reverted: df04f70 Bump version 11677eb Merge pull request benbernard#8 from alexbt/fix-empty-unresolved 45a7834 Track unresolved comments with Map 999adab Merge pull request benbernard#7 from alexbt/unresolved-files-bottom 30068dd Add unresolved comments at bottom of files tab f822008 Update version number 5af02ab Merge pull request benbernard#6 from alexbt/options-style ee5528a Merge pull request benbernard#5 from alexbt/files-tab 82a1975 Merge pull request benbernard#4 from alexbt/unresolved-bottom 64bcd6a Use chrome style options page 519c5e2 Display unresolved comments at the bottom 42fe47c Load thread comments from the 'files' tab
This commit temporarily reverts the contributions made by @alexbt between Oct 9, 2017 and Oct 11, 2017. Reason: to merge the significant refactoring of the codebase made in: benbernard#9 The contributions made by @alexbt will be restored on top of the refactoring commits. The following is a list of the commits that have been reverted: df04f70 Bump version 11677eb Merge pull request benbernard#8 from alexbt/fix-empty-unresolved 45a7834 Track unresolved comments with Map 999adab Merge pull request benbernard#7 from alexbt/unresolved-files-bottom 30068dd Add unresolved comments at bottom of files tab f822008 Update version number 5af02ab Merge pull request benbernard#6 from alexbt/options-style ee5528a Merge pull request benbernard#5 from alexbt/files-tab 82a1975 Merge pull request benbernard#4 from alexbt/unresolved-bottom 64bcd6a Use chrome style options page 519c5e2 Display unresolved comments at the bottom 42fe47c Load thread comments from the 'files' tab
This commit temporarily reverts the contributions made by @alexbt between Oct 9, 2017 and Oct 11, 2017. Reason: to merge the significant refactoring of the codebase made in: benbernard#9 The contributions made by @alexbt will be restored on top of the refactoring commits. The following is a list of the commits that have been reverted: df04f70 Bump version 11677eb Merge pull request benbernard#8 from alexbt/fix-empty-unresolved 45a7834 Track unresolved comments with Map 999adab Merge pull request benbernard#7 from alexbt/unresolved-files-bottom 30068dd Add unresolved comments at bottom of files tab f822008 Update version number 5af02ab Merge pull request benbernard#6 from alexbt/options-style ee5528a Merge pull request benbernard#5 from alexbt/files-tab 82a1975 Merge pull request benbernard#4 from alexbt/unresolved-bottom 64bcd6a Use chrome style options page 519c5e2 Display unresolved comments at the bottom 42fe47c Load thread comments from the 'files' tab It brings us back to the following commit: aabd942 Changes for parse deprecation
Remove dependency underscore-min.js, remove waitForKeyElements.js
|
I've created a commit (f34b03a) that temporarily reverted the contributions @alexbt made. I'll work on adding them (i.e. whichever are still applicable) back on top of my changes. 🏃 I'll also work on restoring the feature where if new a comment is added to a thread, the thread becomes "Unresolved". Perhaps, instead of having an options change, it could be controlled through a context menu displayed when the user clicks on the extension button/icon. 👍 |
|
Hey arjun, just checking on the status of this, if you still want to get this in, happy to help / give guidance :). Totally understand if real work/life has side tracked this for you (I'm about to do some work on this to fix it for recent github changes) |
(This is a not-yet-ready PR.) @benbernard I began a significant/major rewrite of your CommentTracker a few months ago, and I wanted to get your feedback on the work so far, before investing further effort into it. Some of the highlights of this rewrite are:
content.js+background.js.background.jsdeals with communicating w/ Parse & Firebase.content.jsdeals with manipulating the DOM / all the UI stuff.setInterval.waitForKeyElements.jshas been eliminated.)underscore.jsby using comparable functions from RxJS.There is a lot more work I have planned, including a significant reworking/improvement of UI/UX of this extension, adding Flow type checking to the code, maybe moving away from jQuery to something lighter, etc.
☑️ Firefox Support Saga
This extension (with these changes) will now work out-of-the-box 😂 on Mozilla Firefox. 😄
However, getting it to work on Firefox was a real pain. 😅 The biggest problem was that if an extension talks to a cross-origin server (in our case, Firebase/Parse), and the web page specifies a CSP (Content Security Policy), like GitHub does, then Firefox applies the CSP to the extension's content scripts as well, whereas Chrome does not. This is a bug that they've acknowledged, but have not fixed in over a year: https://bugzilla.mozilla.org/show_bug.cgi?id=1267027
This bug made it very painful to migrate this extension to Firefox, as the only workaround was to create both a background script and a content script, with the talking to the server happening in the background script, and then having the background script act as a pipe, and relay information back and forth to/from the content script. (It's ridiculous.) I had a fair bit of trouble getting the communication between content page(s) and the background page working.
But a small positive to this added complexity, is that the extension is more efficient now. The instance of Firebase/Parse library is no longer duplicated in every tab. All of the GitHub tabs now share the same instance of Firebase/Parse. So this likely leads to lowered network socket usage (assuming one instance uses a single WebSocket for all communication), and likely to lowered memory (and CPU) usage as well.
The other problem I had when migrating to Firefox, had to do with using libraries. In Chrome, I could just list the library before the script, and it would just work. For example, I could just do:
content_scripts: ['Rx.min.js', 'content_script.js'], and it worked. In this case, withRx.min.js, I was able to refer toRxwithout any trouble inside my content script in Chrome. However, in Firefox, it didn't work ––Rxwas simply an undefined variable. Even thoughRx.min.jswas something that you could include in a page with a<script>tag, so it should have set theRxvariable. Oh well... so I ended up usingwebpackinstead and 'a more proper' dependency management system withyarn/nodeto be able to use Rx inside the content script on Firefox.