Coder Social home page Coder Social logo

benjol / se-autoreviewcomments Goto Github PK

View Code? Open in Web Editor NEW
97.0 97.0 40.0 8.99 MB

AutoReviewComments - Pro-forma comments for SE

Home Page: http://stackapps.com/q/2116

Shell 0.10% PowerShell 0.09% Python 12.36% HTML 0.62% JavaScript 86.64% CSS 0.03% Batchfile 0.16%

se-autoreviewcomments's People

Contributors

alerque avatar benjol avatar codygray avatar derek1906 avatar glorfindel83 avatar gparyani avatar izzysoft avatar julian-o avatar kamil-tekiela avatar machavity avatar mdoubledash avatar mjpieters avatar oliversalzburg avatar onlineth avatar paulroub avatar samliew avatar sathyabhat avatar shog9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

se-autoreviewcomments's Issues

Extension is no longer working in Chrome 36.0.1985.125?

I just noticed today that I'm no longer getting the "auto" button showing up when I go to comment. Doesn't work on any of the SE sites best I can tell. I went through and removed the extension and re-installed from the Google Store and still no luck.

Where did the "Welcome check" go?

With 1.4.0 (or was it the update to Firefox-36?), the "welcome check" seems to be gone. Before, the script checked whether the poster of a question/answer was a new user, and if so added the "Welcome message". As it is now, there is no welcome message added anymore. Also, details on the user are no longer displayed on top of the popup.

A little analysis turned out that getUserId() seems to be broken: userlink.length is always 0, so we get no userId, so we cannot check whether the user is new. Seems to be trouble with the DOM selector: there is no el.parents('div') (length:0, which IMHO means "not found"?). Even more strange is where el itself seems to point here: Object { 0: Window → how-to-store-image-from-camera-into-variable-in-android-programming, length: 1 } – that's the "page" part of the URL, not the current element.

I think I've fixed that by adjusting line 791:

- var userid = getUserId($(this));
+ var userid = getUserId($("#content"));

I've not thoroughly tested it yet, but it seems to work on questions and answers alike (checked on a few of both). Can anybody confirm?

EDIT: My fix only works for answers if there's not more than one (but I've just verified the same issue on my second machine – so it exists on FF36 with Windows and Scriptish as well as with Linux and Greasemonkey). It seems to be the right place to fix it (line 791), but not the right fix ("#content").

EDIT-2: This one is better – and most likely even the right one:

- var userid = getUserId($(this));
+ var userid = getUserId(targetObject);

Quick test: Works on questions (yes), single answers (yes), multiple answers (yes!). Still, someone else please cross-check 😇

Wrong comment inserted while editing

When editing a comment (by double-clicking it) while it is selected, pressing the Insert button will cause invalid data to be inserted into the target.

Fix minified build

The minified build currently breaks the auto-update system in several ways. First the build props need to support setting the auto-update URL to the version being used. Secondly a number of variables and functions need name protection across releases. Lastly it needs to stop stripping out "apparently unused" code bits. Just because a variable is assigned and not used in a function doesn't mean it isn't referenced externally.

Code style

I know this has the potential to cause a very long discussion, but we need to have it ;D

We should settle on a code style that we should follow. The current mix of different styles is very confusing.

The major points we need to settle on are:

  1. Strings - Single or double quotes?
  2. Spaces - Spaces within function call parenthesis? Spaces after comma?

As an example, I've set up https://github.com/oliversalzburg/SE-AutoReviewComments/tree/feature/code-style with our company code style applied to the main parts of the project. The main aspects here are:

  1. Double-quotes for strings
  2. Spaces inside parenthesis and around operators and delimiters
  3. K&R bracing style
  4. if, for, etc enforce opening brace
  5. Opening brace enforces newline
  6. Main indents are tabs (4 spaces wide), secondary indents are spaces (aka "smart tabs")

Auto generate test keys if none found

The process of generating Chrome extension packages requires a signing key is the form of a pem certificate. This needs to be private and kept the same access releases so it is not included in the repo. However a test one could easily be generated if none was found at build time. This would make it easier on developers to hack on without a lot of setup.

Mozilla review: Shallow wrappers do not exist anymore

(1.3 from Issue #37)

Shallow wrappers do not exist anymore, nor should they ever have been needed for the functionality you're using them for, nor should you need to unwrap the content window that you're referring to at all.

"auto" link doesn't appear

Possibly because of the update to the comments system, the "auto" link next to "help" no longer appears.

Firefox addon only works on SO

The latest builds (1.3.3.x?) of the Firefox add-on seem to only work on Stack Overflow, not on any of the other Stack Exchange network of sites.

Stopped working: Uncaught TypeError: Cannot read property 'replace' of undefined

A few days ago, the plugin stopped working for me (on Chrome). Another user confirmed it stopped working for him (on Firefox).

I am running AutoReviewComments 1.3.3 on Chrome Version 36.0.1985.125 m.

The symptoms are that the site looks like it normally does without the plugin, and the JS Console reports:

Uncaught TypeError: Cannot read property 'replace' of undefined

when "Add a comment" is clicked.

New Comment mechanism has broken script

SE has changed its comment mechanism as a result of separating the "Expand comment list" from "Add comment". An error is now flagged highlghting line 440 of the user script, which no longer works in Chrome or Firefox.

var divid = $(this).attr('id').replace('-link', ''); 

"auto" link gets multiplied when putting multiple comments on the same post

When adding a comment, the "auto" link gets multiplied:

  • on the first comment, it's a single link
  • on the second comment, you get two links
  • on the third comment, it will be 3 links (see screenshot)
  • on th..is place, I've stopped trying 👀

To reproduce: Pick a post (in my case it was an answer) without comments, create the first, then create the next, and so on. Note this does not initially happen when you're e.g. the third to comment – only when you yourself put multiple comments in a row on the same post (e.g. if you've got to split-up your too-long comment).

Screenshot

Encountered here with the latest (1.4.0) version.

Pull existing comment text into [type here] placeholder on insert

Often I start writing a comment asking for clarification in the question before remembering that most such comments are simply replied to, rather than resulting in an edit, and switching to the custom auto-comment that emphasizes [edit]ing because of [type here] reason. But, of course, then I lose what I typed. Usually it's not worth copying to the clipboard, but it would still be nice to have it grab that text and pre-select it in place of the placeholder.

Figure out who is going to release to app stores

The new build process (See #5) auto-generates extensions for major browsers in a ready to upload format. The only catch is at least with the Chrome Web Store, packages need to be consistently signed with the same key. Whoever this is should be decided upon and generate a autoreviewcomments.pem file. If this is Derek, he should already have the one he's been using, but this build process should replace his. If it is somebody else we should probably start them with a clean cert.

Build should fail if unable to sign packages

Right now the build system tries to build Chrome packages but fails if no signing key is found (see #10). The build target however continues. This error should at least work that build target as failing.

Mozilla review: running code on page load event

(2.1 from Issue #37)

You're running code, when you receive a content page load event, and assuming that the load event refers to the current 'content' window, which need not be the case. It could be any subframe, or any content document, of any tab.

Not working in FireFox 34

This add-on does not work in FireFox 34 on Linux. I'm not sure at what version it quit working; I have had it disabled for quite a while.

I have tried starting FireFox with a brand-new profile, and it still doesn't work.

By "doesn't work", I mean it does not put an 'auto' link next to the 'help' link in the comments box.

Figure out how to get the 'announcement' function working, or delete it

The idea was originally to be able to send out 'service announcements' outside the stock auto-update detection. (Things like 'please vote on the list of issues on GitHub'). Unfortunately, localstorage being what it is, it forced users to 'ack' the message on every site. Not good.

I actually haven't felt the 'need' for this functionality very often, so I'd be more inclined to zap it, but putting this out here just in case anyone else wants/likes it.

Remove auto-update code from extensions

The ant build process is currently including the full source for pretty much all builds. The sections related to auto-update should be removed from the extension builds, probably before the extensions packages of the current release are submitted.

use version number logic instead of stringwise version check

The current version checking mechanism uses a stringwise test on the version string. This works for many cases but it is brittle and I already broke it it my local devel branch testing auto-updates. Some of the feature branch devel tries are likely to outlive 10 test releases, and it's not impossible the main release tree might someday do the same. (it already did once, see tag v1.2.0).

We should stop being lazy and add a JS function with some actual logic for testing version numbers. I'm sure such a thing exists.

This logic con be re-used for testing for updates to remote json comment sources.

Comments disappear after some time

I have not yet pinpointed when the comments self-destruct, but the comments are not stored long-term once imported. I'm not sure if this is a bug or a feature request, but I'm leaning towards the former.

I think it may have to do with the app initialization either misreading/overwriting the memory on load (unlikely programming error) or the data itself isn't stored in a dependable, long-term storage area.

Browser: Chrome 38 beta

Fix build on OS X

Of course the binaries we use for signing Chrome extensions don't run on OS X.

chrome-crx:
     [exec] /Users/caleb/projects/SE-AutoReviewComments/SDK/buildcrx: /Users/caleb/projects/SE-AutoReviewComments/SDK/buildcrx: cannot execute binary file

Not sure what the fix is but at the very least that step should be skipped if the signing tool cannot be executed.

Humongous arrows in latest build

image

The latest build introduces these fantastic arrows which make the extension border line unusable. They are present whether or not the "show/hide desc" option is used.

Please fix this ASAP.

I'm using Comodo Dragon browser, which for practically all purposes can be considered equal to Google Chrome. I'm on Windows 7 x64, should it matter.

Make script work in the Edit Summary

('Imported' from here)

It would be great to be able to use this same functionality in the edit summary when making edits. Most of the edits I do fall into a small subset of "categories" and it pains me to have to put in the same summary over and over.

Adding a category (much like already exists for question-only or answer-only comments) would be a big help beyond just adding the "auto" link next to the edit summary input box.

To take it one step more, since edits may be for more than one thing at a time, a slightly different interface that is checkbox-based, rather than radio buttons would be ideal so that I could combine / chain the edits I've made.

In summary, here's what I am asking for (in order of priority / usefulness):

  1. Adding the dialog link to the Edit Summary input
  2. Adding a category for Edit Summaries
  3. Changing the behavior for edit summaries to allow for adding multiple "comments"

Automated testing

I haven't got the faintest idea if/how this would be possible, but just throwing the idea in here for discussion. I think I've got free minutes on Azure/VS-online, but this would also imply having a test account with enough rep for multiple sites...

"Auto" link can't be inserted due to error

Probably due to the new comment format, but I'm getting an error when clicking the "add comment" link on Stack Overflow.

The error is

"Uncaught TypeError: Cannot read property 'replace' of undefined"

This is a screenshot of the error and source code. I did a few lines in the console to get some additional information.

image

The line with the breakpoint (524 on the screenshot) throws the error. It seems that the element that jquery is searching for does not have an id, so it can't replace the text inside.

I'm using Chrome 36.0.1985.125 m with AdBlock turned off. The chrome extension is v1.3.3.

Welcome text no longer automatically inserted

I am using 1.4.0 on Chrome on one of the mid-sized Stack Exchange sites.

(Weird: I don't remember updating to 1.4. But everything looks different now, since I returned from holidays. But Chrome Web Store is still at 1.3.3. Huh. Confused.)

The user's details (how long they have been a member) are no longer displayed and the Welcome message is no longer inserted.

Update to 1.17 of Mozilla SDK

Feedback from Mozilla review:

You are using version 1.16 of the Add-on SDK, which is outdated. Please upgrade to version 1.17 and repack your add-on

Include build instructions in the readme

Getting ant and ant-contrib setup (at least on Windows) is apparently not quite simple. Which version to use and the easiest install path for somebody new to using it should probably be included in the readme along with basic instructions on how to use the various targets (e.g. how to just make a test build of the user-script, etc).

Default comments don't *actually* contain any question comments

(On devel) with the targetting prefixes, the first default (reset) comments are marked as 'Target.CommentQuestion', but if you actually read them, they only apply to Answers. Have we got any example frequently used question comments we could slip in?

Mozilla review: fixup targetSites array

(2.2 from Issue #37)

You really need to anchor the regular expressions in your targetSites array. You also need to escape your backslashes if you're not using regexp literals. The '.'s at the end of your regular expressions also serve no purpose. You also need to use something other than '.' for your domain tests, e.g., '[-.a-z0-9]*'

Move default comments to external sources

After reading the chatter the other day about comment data and import/export, I've been thinking our arrangement could be something like this:

  • The userscript/extension source code would have no default comment data whatsoever.
  • A repository (could be a secondary repo, the main one or a branch) would have the default comment data in json or text format.
    • A data file per site URL would make it easy for misc contributors from other sites to get good site specific data into as many hands as possible.
    • A fallback URL would have generic data to be loaded in any site that does not have a custom data set contributed.
  • The first time the popup runs on a new site it would detect that the localStorage has no default comment data for that site.
    • A popup would prompt the user to import data with an "import from URL" option pre-filled out with the relevant URL (but editable) and a "or paste data here" field to allow for users mucking around in their data manually or copying from a meta site post.
  • For sites that already have data in localStorage, a an "edit data" link would take the user back to the import form where they can either refresh from the URL or edit/paste in a new data set.

How does that arrangement scan?

Uncaught TypeError: Cannot read property 'replace' of undefined

I'm on Chromium 39.0.2171.65 in Ubuntu 14.04 and installed the AutoReviewComments extension from the Chrome webstore.

When I go to any SE page and hit 'add comment', no 'auto' link is added. Instead, I see this in the console:

Uncaught TypeError: Cannot read property 'replace' of undefined      VM247:524
  (anonymous function)                                               VM247:524
  f.event.dispatch                                                   jquery.min.js:3
  h.handle.i                                                         jquery.min.js:3 

The line that is referred to is the second line here:

$("#content").delegate(".comments-link", "click", function () {
  var divid = $(this).attr('id').replace('-link', '');
  var posttype = $(this).parents(".question, .answer").attr("class").split(' ')[0]; //slightly fragile

Is it possible to use the extension in Chromium?

If you need more details, shout!

Mozilla NOT happy...

(This probably/maybe needs splitting into multiple issues):

Your add-on, SE-AutoReviewComments 1.3.3.2, has been reviewed by an editor and did not meet the criteria for being hosted in our gallery.

  1. (Issue #39): We don't allow add-ons to use remote scripts because they create serious security vulnerabilities. We also need to review all of your add-on code, and this makes it much more difficult. Please insert those scripts locally from your add-on code.

    Please note that JSONP is considered remote script injection.

  2. (Issue #40): Your add-on creates DOM nodes from HTML strings containing unsanitized data, by assigning to innerHTML or through similar means. Aside from being inefficient, this is a major security risk. For more information, see https://developer.mozilla.org/en/XUL_School/DOM_Building_and_HTML_Insertion

  3. (Issue #41): Shallow wrappers do not exist anymore, nor should they ever have been needed for the functionality you're using them for, nor should you need to unwrap the content window that you're referring to at all.

This version didn't pass full review because of the following issues:

  1. (Issue #42): You're running code, when you receive a content page load event, and assuming that the load event refers to the current 'content' window, which need not be the case. It could be any subframe, or any content document, of any tab.

  2. (Issue #43): You really need to anchor the regular expressions in your targetSites array. You also need to escape your backslashes if you're not using regexp literals. The '.'s at the end of your regular expressions also serve no purpose. You also need to use something other than '.' for your domain tests, e.g., '[-.a-z0-9]*'

  3. Please provide us with detailed information on how to test your add-on. If authentication to a website is necessary, give us a test username and password to facilitate our work. This information can be added to the Notes to Reviewers field of the version you are submitting (and future versions preferably), and in a reply to this review email.

Please fix them and submit again. Thank you.

Tested on Linux with Firefox 22.0

This version of your add-on has been disabled. You may re-request review by addressing the editor's comments and uploading a new version. To learn more about the review process, please visit https://addons.mozilla.org/developers/docs/policies/reviews#selection

Improve security by avoiding use of innerHTML

Feedback from Mozilla review

Due to both security and performance reasons, innerHTML (or similar method e.g. insertAdjacentHTML, JQuery append/prepend/appendTo/html/before/after/insertBefore/insertAfter) should not be set using dynamic values. This can lead to security issues or fairly serious performance degradation.

For inserting text, textContent (or JQuery text) or createTextNode() should be used instead of innerHTML.
For inserting HTML, the safer method is to use createElement(), textContent, appendChild() instead of innerHTML.
Removing the innerHTML will improve add-on's prospect of approval.

No "auto" comment link on beta sites

Using AutoReviewComments 1.3.3.1 on Firefox 27.0.1 on Windows 7 SP1 x64, I do not get the "auto" link for commenting on beta sites, although I do see it on non-beta sites.

Mozilla review: remote scripts & jsonp

(1.1 From #37)

We don't allow add-ons to use remote scripts because they create serious security vulnerabilities. We also need to review all of your add-on code, and this makes it much more difficult. Please insert those scripts locally from your add-on code.

Please note that JSONP is considered remote script injection.

1.3.3/FF30/GM1.8: No "auto" menu

Hi,

version 1.3.3 in FF 30 with Greasemonkey 1.8 doesn't display the "auto" menu in the comments, neither on unix.se.com nor on any other site. I also tested FF32 but again, no luck.

update breaks on Opera

After updating to v1.4.0 on Opera browser v12.16 (stock version on SciLinux 6.5), the 'auto' button no longer appeared on Physics.SE and Meta.Physics.SE (didn't check any other sites).

Rolling back to v1.3.3.3 returns the 'auto' button to its normal place.

Make script work in the custom "off-topic" closure reason

Imported from here.

Can we have the auto link appear when completing a custom "off-topic" closure reason?

Bonus points if we can declare certain auto-comments to apply in this scenario (e.g. mirroring the "A" and "Q" prefix for answers and questions). Perhaps "C" for closure reasons?

clnxc

Add UnTag step to GetRemote URL

I am building a system (see chat room http://chat.stackexchange.com/rooms/20341/stackmonkey ) that will support supplying different comment-sets for different stack sites. The logical way to do this would be to have a SetStorage for each stack site, but an interim solution would be to do the auto-load of comments, and supply the Stack site $SITEURL$ as part of the remote URL... for example:

http://path.to.my.server/commentsource/$SITEURL$/comments

By adding UnTag support to the URL in GetRemote you can allow people to be smarter about what their remote source supplies.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.