Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a Base Repository
hypothesis/h
robertknight/h
40a/h
AFDudley/h
BigBlueHat/h
BinaryStars/h
CCH543/h
Cinemacloud/h
Ericgood/h
FTG-003/h
Forethinker/h
GratefulTony/h
HGldJ1966/h
JJediny/h
John-Williams/h
Laurian/h
LittleFancy/h
MattyQ/h
Mishkin2015/h
RichardLitt/h
Staffan1/h
SteelWagstaff/h
TowerBR/h
VanyTang/h
abigailricarte/h
ackermann/h
alecchap/h
alesarrett/h
alexsegura/h
almereyda/h
alon/h
andzi/h
angelicxsoul/h
ansmoh/h
apurvajalit/h
arjunvasan/h
asdevor/h
bZichett/h
badgettrg/Webmarks
balmas/h
balupton/h
bbarker/h
bennlich/h
benthor/h
blakewest/h
bogste/h
bradparks/h
brittanystoroz/h
buiquangchien/h
cdchapman/h
charblanc/h
chowsamihq/h
chr7stos/Webmarks
chrber/h
chrismPssina/h
christinaphamAD/h
cmbirk/h
codeaudit/h
coolcool21/h
cove/h
csillag/h
danjimilk/h
dannyhope/h
daredream/h
davidmcclure/h
dennisplucinik/h
dezynetechnologies/h
diegodlh/h
djcun95/h
donsequitur/h
edsu/h
eiro10/h
emckean/h
ercchy/h
eshellman/h
fangang123/h
fchasen/h
fcrimins/h
fhirsch/h
ficolo/h
fragkopoulos/h
gauravkeerthi/h
geass/h
gergely-ujvari/h
gitter-badger/h
gnott/h
gobengo/h
gorinovic/h
gus3000/h
hashin/h
helemaalbigt/h
hmstepanek/h
hwasiti/h
hylhero/h
hyperstudio/h
iHDeveloper/h
imeysam/h
jackspaceBerkeley/h
jarey/h
jasdeep/h
jason790/h
jasonzou/j
jazahn/h
jccr/h
jean/h
jeka57/h
jeremydean/h
jermnelson/h
jibe-b/h
jnishiyama/h
jojksd/h
jpadilla/h
jtremback/h
judell/h
juli-so/h
kabacs/h
karissa/h
kaushikvijay/h
kaydoh/h
kill4uk/h
klopiinas/h
klrkdekira/h
koulihong311/h
krassif/h
krstnkngs/h
leoqmp/h
linhua55/h
lucadealfaro/h
lyspooner/h
lyzadanger/h
m1yag1/h
magee/h
mambocab/h
manunymous/h
maraino/h
mari-ja/h
markbarratt/h
martinq/h
mbbaig/h
mcarv63/h
meawoppl/h
meflyup/h
metasj/h
mgasner/h
mgax/h
mollycr/h
mrchrisadams/h
mrienstra/h
mshavlovsky/h
muddasani/h
nagyist/hyphothesis-h
nagyistoce/hypothesis-h
nanxio/h
neozhangthe1/h
ningyifan/h
nkingsley/h
nlholdem/h
nlisgo/h
noscripter/h
nshkuro/h
odnodn/h
oliversauter/h
openbizgit/h
opengovfoundation/h
openstax/hypothesis-server
ouroboros8/h
pablomarti/h
pamo/h
philipn/h
philschatz/h
pinballwonder/h
plainspace/h
raowl/h
rickyhan/h
rmoorman/h
rmtsukuru/h
rowhit/h
rsarxiv/h
saakaifoundry/h
samrose/h
scharf/h
shepazu/h
sherah/h
shofheinz/h
soapdog/h
ssin122/test-h
st-fresh/h
stuk88/h
sylvanmist/h
tetratorus/h
tilgovi/h
tomnar/h
trivenews/h
truthadjustr/h
utngz/h
voidfiles/h
wenchen/h
yargevad/h
yumatch/h
zshen777/h
Nothing to show
Choose a base branch
2263-tooltip-for-note-button
anchoring-rewrite
angular-1.3
angular-1.4_rob
app-cors
app_startup_metrics
assets-view-tests
atom-link-related
autoprefix_css
avoid-group-reload-on-change
better-dockerfile-caching
bridge_timeout_debugging
browserify_extension
build_deps_before_test
categorized_logging
change-username-form
check-asset-versions-v2
decaf
deduplicate-password-validation
deps-auto-update
ejp
embedding-docs-link
enable-group-creator-deletion-split-delete-method
enriched-stream
extension-badge-tint
extension_badge_refactor
extension_build_type_indicator
extension_embed_conflict
form-preact
frontend_build_refactor
frontend_tests_docs
gh2505-autolink
gh2553-fix_selection_filter
gh2561-highlight_text_revert
gh2563-test_timeout_debugging
gh2568-safari_missing_urls
gh2641-no_reload_on_groups_list_change
gh2642-reload_fouc
gh2646-bucket_bar_pos
gh2654-safari_search_expander
gh2663-do_not_switch_group_on_leave
groups_changed_exception
groups_list_selection_fix
groups
icon_font_fix
icon_font_fix_2
improve-form-field-list-design
index-and-search-elasticsearch6
index-authority
karma-watch-target
login-with-google
master
multitarget
nipsa
oauth-admin
oauth-login-prototype
p-frontend_build_refactor
p-fx-webextensions
p-new_highlighter
p-new_threading_impl
p-preact_annotation
p-preact_components
p-thread_model
parallel-reindex
publish-btn-cleanup
py3-docker
quote-anchor-integration-test
refactor-sidebar-injector-test
replace-angular_websocket
reply-count-badge
rob-setup_docs_corrections
search-bar-preact
search-bar-tidy-up
search-decaf
search-tests
server_sorted_groups
support-sqs
t87-editorconfig-sass
t87-group_scope_dropdown_ui
t88-remove_self_from_group
t89-combined_scope_save_btn
t89-group_list_css_refactor
t90-search_icon_click
t90-top_bar_new_design
t90-top_bar_refactor
t91-sort_dropdown_move_to_top_bar
t91-sort_dropdown_refactor
t93-clear_selection_btn_ux
t93-create_group_refresh
t105-group_push_notifications
t112-center_post_dropdown
t125-post_button_ui_fixes
t139-new_loading_indicator
t148-card_group_style_refactor
t152-move_unsaved_annot_to_current_group
t182-chrome_perms_refactor
t187-new_homepage_design
thread-collapsing
travis-flake8
v0.2.x
v0.3.x
visual-truncation
websocket-send-on-reconnect
z-login-with-google
z-py3-working-docker-img
z-py3
z-search-tests
Nothing to show
Choose a Head Repository
hypothesis/h
robertknight/h
40a/h
AFDudley/h
BigBlueHat/h
BinaryStars/h
CCH543/h
Cinemacloud/h
Ericgood/h
FTG-003/h
Forethinker/h
GratefulTony/h
HGldJ1966/h
JJediny/h
John-Williams/h
Laurian/h
LittleFancy/h
MattyQ/h
Mishkin2015/h
RichardLitt/h
Staffan1/h
SteelWagstaff/h
TowerBR/h
VanyTang/h
abigailricarte/h
ackermann/h
alecchap/h
alesarrett/h
alexsegura/h
almereyda/h
alon/h
andzi/h
angelicxsoul/h
ansmoh/h
apurvajalit/h
arjunvasan/h
asdevor/h
bZichett/h
badgettrg/Webmarks
balmas/h
balupton/h
bbarker/h
bennlich/h
benthor/h
blakewest/h
bogste/h
bradparks/h
brittanystoroz/h
buiquangchien/h
cdchapman/h
charblanc/h
chowsamihq/h
chr7stos/Webmarks
chrber/h
chrismPssina/h
christinaphamAD/h
cmbirk/h
codeaudit/h
coolcool21/h
cove/h
csillag/h
danjimilk/h
dannyhope/h
daredream/h
davidmcclure/h
dennisplucinik/h
dezynetechnologies/h
diegodlh/h
djcun95/h
donsequitur/h
edsu/h
eiro10/h
emckean/h
ercchy/h
eshellman/h
fangang123/h
fchasen/h
fcrimins/h
fhirsch/h
ficolo/h
fragkopoulos/h
gauravkeerthi/h
geass/h
gergely-ujvari/h
gitter-badger/h
gnott/h
gobengo/h
gorinovic/h
gus3000/h
hashin/h
helemaalbigt/h
hmstepanek/h
hwasiti/h
hylhero/h
hyperstudio/h
iHDeveloper/h
imeysam/h
jackspaceBerkeley/h
jarey/h
jasdeep/h
jason790/h
jasonzou/j
jazahn/h
jccr/h
jean/h
jeka57/h
jeremydean/h
jermnelson/h
jibe-b/h
jnishiyama/h
jojksd/h
jpadilla/h
jtremback/h
judell/h
juli-so/h
kabacs/h
karissa/h
kaushikvijay/h
kaydoh/h
kill4uk/h
klopiinas/h
klrkdekira/h
koulihong311/h
krassif/h
krstnkngs/h
leoqmp/h
linhua55/h
lucadealfaro/h
lyspooner/h
lyzadanger/h
m1yag1/h
magee/h
mambocab/h
manunymous/h
maraino/h
mari-ja/h
markbarratt/h
martinq/h
mbbaig/h
mcarv63/h
meawoppl/h
meflyup/h
metasj/h
mgasner/h
mgax/h
mollycr/h
mrchrisadams/h
mrienstra/h
mshavlovsky/h
muddasani/h
nagyist/hyphothesis-h
nagyistoce/hypothesis-h
nanxio/h
neozhangthe1/h
ningyifan/h
nkingsley/h
nlholdem/h
nlisgo/h
noscripter/h
nshkuro/h
odnodn/h
oliversauter/h
openbizgit/h
opengovfoundation/h
openstax/hypothesis-server
ouroboros8/h
pablomarti/h
pamo/h
philipn/h
philschatz/h
pinballwonder/h
plainspace/h
raowl/h
rickyhan/h
rmoorman/h
rmtsukuru/h
rowhit/h
rsarxiv/h
saakaifoundry/h
samrose/h
scharf/h
shepazu/h
sherah/h
shofheinz/h
soapdog/h
ssin122/test-h
st-fresh/h
stuk88/h
sylvanmist/h
tetratorus/h
tilgovi/h
tomnar/h
trivenews/h
truthadjustr/h
utngz/h
voidfiles/h
wenchen/h
yargevad/h
yumatch/h
zshen777/h
Nothing to show
Choose a head branch
2263-tooltip-for-note-button
anchoring-rewrite
angular-1.3
angular-1.4_rob
app-cors
app_startup_metrics
assets-view-tests
atom-link-related
autoprefix_css
avoid-group-reload-on-change
better-dockerfile-caching
bridge_timeout_debugging
browserify_extension
build_deps_before_test
categorized_logging
change-username-form
check-asset-versions-v2
decaf
deduplicate-password-validation
deps-auto-update
ejp
embedding-docs-link
enable-group-creator-deletion-split-delete-method
enriched-stream
extension-badge-tint
extension_badge_refactor
extension_build_type_indicator
extension_embed_conflict
form-preact
frontend_build_refactor
frontend_tests_docs
gh2505-autolink
gh2553-fix_selection_filter
gh2561-highlight_text_revert
gh2563-test_timeout_debugging
gh2568-safari_missing_urls
gh2641-no_reload_on_groups_list_change
gh2642-reload_fouc
gh2646-bucket_bar_pos
gh2654-safari_search_expander
gh2663-do_not_switch_group_on_leave
groups_changed_exception
groups_list_selection_fix
groups
icon_font_fix
icon_font_fix_2
improve-form-field-list-design
index-and-search-elasticsearch6
index-authority
karma-watch-target
login-with-google
master
multitarget
nipsa
oauth-admin
oauth-login-prototype
p-frontend_build_refactor
p-fx-webextensions
p-new_highlighter
p-new_threading_impl
p-preact_annotation
p-preact_components
p-thread_model
parallel-reindex
publish-btn-cleanup
py3-docker
quote-anchor-integration-test
refactor-sidebar-injector-test
replace-angular_websocket
reply-count-badge
rob-setup_docs_corrections
search-bar-preact
search-bar-tidy-up
search-decaf
search-tests
server_sorted_groups
support-sqs
t87-editorconfig-sass
t87-group_scope_dropdown_ui
t88-remove_self_from_group
t89-combined_scope_save_btn
t89-group_list_css_refactor
t90-search_icon_click
t90-top_bar_new_design
t90-top_bar_refactor
t91-sort_dropdown_move_to_top_bar
t91-sort_dropdown_refactor
t93-clear_selection_btn_ux
t93-create_group_refresh
t105-group_push_notifications
t112-center_post_dropdown
t125-post_button_ui_fixes
t139-new_loading_indicator
t148-card_group_style_refactor
t152-move_unsaved_annot_to_current_group
t182-chrome_perms_refactor
t187-new_homepage_design
thread-collapsing
travis-flake8
v0.2.x
v0.3.x
visual-truncation
websocket-send-on-reconnect
z-login-with-google
z-py3-working-docker-img
z-py3
z-search-tests
Nothing to show
Commits on Oct 29, 2015
Avoid reloading whole view when focused group changes
When the focused group changes, instead of reloading the whole
view just unload the currently displayed annotations and then
reload the annotations for the newly selected group(s) and
any drafts of unsaved annotations.

The only immediately 'visible' effect of the change is
that switching groups now only results in a call to /search
rather than network requests to fetch session state and features.

In future this should make it easier to preserve state
for the area below the top bar when switching groups.
Add some comments to explain what the `threading` service is for.
Add documentation explaining what the threading service
does and links explaining the 'jwz' message threading
algorithm and a reference to the JS implementation that
we are using.
Commits on Oct 30, 2015
Don't swallow exceptions when in development mode
In dev mode it's useful to be able to see exceptions when they're
thrown. This enables the interactive Werkzeug debugger that comes with
pyramid_debugtoolbar.
Fix search button not expanding search bar in Safari
The search bar expands from 0 to 150px when the input is focused
but in Safari the <input> will not accept focus via
input.focus() if its max-width is _exactly_ 0px.

Setting it to a near-zero +ve value instead avoids the problem.

Fixes #2654
Merge pull request #2698 from hypothesis/show-traceback-on-exception-…
…in-dev

Don't swallow exceptions when in development mode
Merge pull request #2699 from robertknight/gh2654-safari_search_expander
Fix search button not expanding search bar in Safari
Preserve unsaved changes when switching groups
Refactor the drafts service to preserve unsaved edits
when switching groups.

This rewrites the drafts service so that it can preserve
unsaved changes for new and existing annotations when
switching groups.

For each annotation, the drafts service now maintains
an object containing the unsaved changes in addition to
the model for the annotation which was being edited.

 * For new annotations, the annotation is moved to the current
   group when switching groups.

 * For edits to existing annotations, the unsaved changes are
   saved to the drafts service.

 * When an annotation card is created, switch to editing mode
   automatically if a draft is present.

 * Avoid automatically discarding the draft when an annotation
   is unloaded. This allows unsaved edits to existing annotations
   in a group to be restored when switching back to the group.
Add test for discarding of drafts when annotations are saved
The logic for handling this case in the controller is slightly
indirect. The draft is discarded not when the call to update
the annotation on the server succeeds but whenever the client
is notified that an annotation update has been committed,
signified via its 'updated' property changing.

This happens both for saves triggered locally and also
updates made in other H instances.
Fix new drafts being created when signing out
When signing out whilst a group is selected and
unsaved drafts were present, the following would
happpen:

 1. User prompted to discard drafts

 2. User accepts prompt and draft store is cleared

 3. Group focus changes and a new draft is created

Fix this by only updating a draft when the group
focus changes, not creating a new one if it has been removed
drafts.all() -> drafts.unsaved()
Update widget-controller following drafts service API change.
Couple of minor simplifications
 * Avoid a loop over an array with a single entry

 * Avoid an unnecessary variable shared between multiple
   tests
Remove defunct pattern library helpers
This code is hopelessly out of date.
Add a debug mailer to assist in debugging
Add a dummy mailer implementation that prints the sent emails to STDERR.
This improves on the formatting of the previous dummy mailer by ensuring
that the email content is decoded before printing.
Merge pull request #2689 from robertknight/t152-move_unsaved_annot_to…
…_current_group

Avoid losing unsaved changes to new or existing annotations when switching groups
Commits on Oct 31, 2015
Remove unused claim mail merge module
This module was used to send emails to users who had yet to claim their
usernames. All these emails have now been sent and the module is no
longer needed.
Commits on Nov 02, 2015
Fix display of num replies on collapsed replies
When you collapse a reply that itself has replies an "n replies" link
appears next to the username on the collapsed reply. A recent commit
broke the display/alignment of this. Correct it.

Fixes #2702.
Merge pull request #2704 from hypothesis/2702-fix-diplay-of-num-repli…
…es-on-collapsed-replies

Fix display of num replies on collapsed replies
Appropriately encode the tab URL for a query string
Tab URLs can contain all kinds of weird things, including:

- query strings (`?foo=bar`)
- percent-encoded strings that do not correspond to valid UTF-8
  sequences as mandated by RFC3986 (recently seen: `/ac%FD-pul-biber`,
  an example of ISO-8859-9 percent-encoding)

We need to ensure that when we pass the URL to the badge endpoint we
pass a valid encoded string.

Fixes #2648.
Small design tweaks to the group share page
- Put a <br> between the document link text and the document hostname
  (if there is one)
- Double the amount of vertical space between each <li> in the list of
  documents
- Increase the number of characters after which document link text or
  hostname is truncated
Merge pull request #2709 from hypothesis/urlencode-badge-uri
Appropriately encode the tab URL for a query string
Commits on Nov 03, 2015
Allow concurrent workers
Until benoitc/gunicorn#1127 is released, the WEB_CONCURRENCY environment
variable is ignored for paste applications. Add it explicitly to the
Procfile.
Fix reference to Object.assign shim
This got renamed in core-js without a semver-compliant version bump. Of
course.
Commits on Nov 05, 2015
Commits on Nov 06, 2015
Replace angular-websocket with a minimal WebSocket wrapper
We used to have our own WebSocket wrapper, which was replaced in
cf410d0 with angular-websocket,
since that provided the functionality that we needed on top
of WebSockets, namely:

 * Integration with Angular $scope by wrapping onmessage callbacks
   with $scope.$apply()

 * Automatic reconnection in the event of a disconnection

 * Queuing of messages sent via

Unfortunately, angular-websocket also brings in a somewhat unnecessary
dependency on the "ws" module. That got out of date and resulted in no longer
being able to build H with the current version of Node.
See gdi2290/angular-websocket#47

This gave us either the choice of fixing angular-websocket or
replacing the dependency.

This commit removes the angular-websocket dependency in favor of
our own WebSocket wrapper, but unlike before, we outsource the retry logic
to the "retry" package. A benefit of this is that we get better logging
of what is going on during automated reconnects.
Showing with 756 additions and 1,484 deletions.
  1. +57 −2 CHANGES.txt
  2. +1 −1 Procfile
  3. +2 −2 conf/development.ini
  4. +4 −3 h/api/models.py
  5. +9 −8 h/api/test/models_test.py
  6. +6 −0 h/app.py
  7. +7 −2 h/browser/chrome/lib/tab-state.js
  8. +1 −1 h/browser/chrome/test/browser-action-test.js
  9. +1 −1 h/browser/chrome/test/hypothesis-chrome-extension-test.js
  10. +9 −0 h/browser/chrome/test/tab-state-test.js
  11. +0 −188 h/claim/invite.py
  12. +60 −0 h/debug.py
  13. +4 −8 h/static/scripts/app-controller.coffee
  14. +3 −7 h/static/scripts/app.coffee
  15. +48 −8 h/static/scripts/directive/annotation.coffee
  16. +0 −30 h/static/scripts/directive/group-list.js
  17. +82 −2 h/static/scripts/directive/test/annotation-test.coffee
  18. +3 −34 h/static/scripts/directive/test/group-list-test.js
  19. +0 −41 h/static/scripts/drafts.coffee
  20. +84 −0 h/static/scripts/drafts.js
  21. +1 −1 h/static/scripts/features.js
  22. +26 −18 h/static/scripts/streamer.js
  23. +0 −6 h/static/scripts/test/app-controller-test.coffee
  24. +56 −0 h/static/scripts/test/drafts-test.js
  25. +33 −28 h/static/scripts/test/streamer-test.js
  26. +59 −0 h/static/scripts/test/websocket-test.js
  27. +32 −3 h/static/scripts/test/widget-controller-test.coffee
  28. +19 −1 h/static/scripts/threading.coffee
  29. +99 −0 h/static/scripts/websocket.js
  30. +14 −2 h/static/scripts/widget-controller.coffee
  31. +0 −4 h/static/styles/app.scss
  32. +1 −1 h/static/styles/group-form.scss
  33. +2 −2 h/static/styles/share-link.scss
  34. +9 −1 h/static/styles/simple-search.scss
  35. +8 −7 h/templates/client/annotation.html
  36. +3 −16 h/templates/client/group_list.html
  37. +0 −58 h/templates/email_preview.html.jinja2
  38. +0 −911 h/templates/pattern_library.html.jinja2
  39. +0 −78 h/testing.py
  40. +11 −4 h/views.py
  41. +2 −2 package.json
  42. +0 −3 setup.py
View
@@ -1,5 +1,60 @@
0.7.19 (2015-10-28)
==================
0.7.13 (2015-11-03)
===================
Bug fixes
---------
- Fix a broken reference within our code (502e8df).
0.7.12 (2015-11-03)
===================
Bug fixes
---------
- Fix a couple of small display issues (#2704, #2710).
- Fix an issue where badge URLs were not correctly encoded before being sent to
the server (#2709).
0.7.11 (2015-11-02)
===================
Bug fixes
---------
- Fix a problem where occasionally the set of public annotations would be loaded
into the initial view rather than the set of annotations for the focused group
(feature flagged: groups) (#2684).
- Fix a bug where creating an annotation when signed out (and subsequently
signing in and saving it) could result in invalid permissions fields (#2687).
- Fix a problem in Safari where the search box didn't expand when you clicked on
it (#2699).
- Fix improper case-sensitivity for tag searches (e.g. searches for "Tag123" now
correctly return annotations tagged with "tag123") (#2690).
Features
--------
- Ignore the "gclid" query parameter (a Google AdWords click-tracking param)
when normalising URLs (72f0509).
- Draft annotations are now preserved when switching from group to group in the
sidebar (#2689).
Miscellanea
-----------
- Improvements to Sentry logging (the current URL, headers, and userid are now
recorded with exceptions) (#2697).
- Show the werkzeug debugger on exceptions in development (#2698).
0.7.10 (2015-10-28)
===================
Bug fixes
---------
View
@@ -1,4 +1,4 @@
web: gunicorn --paster conf/${HYP_ENV:-production}.ini
web: gunicorn -w ${WEB_CONCURRENCY:-1} --paster conf/${HYP_ENV:-production}.ini
notification: hypothesis-worker conf/${HYP_ENV:-production}.ini notification
nipsa: hypothesis-worker conf/${HYP_ENV:-production}.ini nipsa
assets: hypothesis assets conf/${HYP_ENV:-production}.ini
View
@@ -19,12 +19,12 @@ multiauth.policy.session.use: pyramid.authentication.SessionAuthenticationPolicy
pyramid.debug_all: True
pyramid.reload_templates: True
pyramid.includes:
h.session
pyramid_debugtoolbar
pyramid_mailer
pyramid_multiauth
pyramid_tm
h.testing
h.debug
h.session
# Set a default persistent secret for development. DO NOT copy this into a
# production settings file.
View
@@ -24,7 +24,7 @@ def _format_document_link(href, title, link_text, hostname):
if hostname and hostname in link_text:
hostname = ""
def truncate(content, length=50):
def truncate(content, length=60):
"""Truncate the given string to at most length chars."""
if len(content) <= length:
return content
@@ -35,9 +35,10 @@ def truncate(content, length=50):
link_text = truncate(link_text)
if href and hostname:
link = '<a href="{href}" title="{title}">{link_text}</a> ({hostname})'
link = ('<a href="{href}" title="{title}">{link_text}</a><br>'
'({hostname})')
elif hostname:
link = '<a title="{title}">{link_text}</a> ({hostname})'
link = '<a title="{title}">{link_text}</a><br>({hostname})'
elif href:
link = '<a href="{href}" title="{title}">{link_text}</a>'
else:
View
@@ -407,7 +407,7 @@ def test_document_link_happy_path(hostname_or_filename, href, title,
assert models.Annotation().document_link == (
'<a href="http://www.example.com/example.html" '
'title="Example Document">Example Document</a> (www.example.com)')
'title="Example Document">Example Document</a><br>(www.example.com)')
@document_link_fixtures
@@ -462,13 +462,13 @@ def test_document_link_truncates_hostname(hostname_or_filename, href, title,
link_text.return_value = "www.example.com/example.html"
# .hostname_or_filename is too long.
hostname_or_filename.return_value = "a" * 60
hostname_or_filename.return_value = "a" * 70
expected_hostname = "a" * 50 + "&hellip;"
expected_hostname = "a" * 60 + "&hellip;"
expected_result = (
'<a href="http://www.example.com/example.html" '
'title="www.example.com/example.html">'
'www.example.com/example.html</a> ({hostname})'.format(
'www.example.com/example.html</a><br>({hostname})'.format(
hostname=expected_hostname))
assert models.Annotation().document_link == expected_result
@@ -481,12 +481,12 @@ def test_document_link_truncates_link_text(hostname_or_filename, href, title,
title.return_value = "www.example.com/example.html"
# .link_text is too long.
link_text.return_value = "a" * 60
link_text.return_value = "a" * 70
expected_link_text = "a" * 50 + "&hellip;"
expected_link_text = "a" * 60 + "&hellip;"
expected_result = (
'<a href="http://www.example.com/example.html" '
'title="www.example.com/example.html">{link_text}</a> '
'title="www.example.com/example.html">{link_text}</a><br>'
'(www.example.com)'.format(link_text=expected_link_text))
assert models.Annotation().document_link == expected_result
@@ -502,7 +502,8 @@ def test_document_link_hostname_but_no_href(hostname_or_filename, href, title,
href.return_value = ""
assert models.Annotation().document_link == (
'<a title="Example Document">Example Document</a> (www.example.com)')
'<a title="Example Document">Example Document</a><br>'
'(www.example.com)')
@document_link_fixtures
View
@@ -5,6 +5,7 @@
from pyramid.config import Configurator
from pyramid.tweens import EXCVIEW
from pyramid.settings import asbool
from h.config import settings_from_environment
from h.security import derive_key
@@ -18,6 +19,10 @@ def configure_jinja2_assets(config):
jinja2_env.assets_environment = assets_env
def in_debug_mode(request):
return asbool(request.registry.settings.get('pyramid.debug_all'))
def create_app(global_config, **settings):
"""Configure and add static routes and views. Return the WSGI app."""
settings = get_settings(global_config, **settings)
@@ -43,6 +48,7 @@ def create_app(global_config, **settings):
def includeme(config):
config.add_request_method(in_debug_mode, 'debug', reify=True)
config.include('h.features')
@@ -1,6 +1,6 @@
'use strict';
var assign = require('core-js/modules/$.assign');
var assign = require('core-js/modules/$.object-assign');
var isShallowEqual = require('is-equal-shallow');
var states = {
@@ -25,6 +25,11 @@ var DEFAULT_STATE = {
ready: false,
};
/** encodeUriQuery encodes a string for use in a query parameter */
function encodeUriQuery(val) {
return encodeURIComponent(val).replace(/%20/g, '+');
}
/** TabState stores the H state for a tab. This state includes:
*
* - Whether the extension has been activated on a tab
@@ -161,7 +166,7 @@ function TabState(initialState, onchange) {
self.setState(tabId, {annotationCount: total});
};
xhr.open('GET', apiUrl + '/badge?uri=' + tabUrl);
xhr.open('GET', apiUrl + '/badge?uri=' + encodeUriQuery(tabUrl));
xhr.send();
};
@@ -1,4 +1,4 @@
var assign = require('core-js/modules/$.assign');
var assign = require('core-js/modules/$.object-assign');
var proxyquire = require('proxyquire');
describe('BrowserAction', function () {
@@ -1,6 +1,6 @@
'use strict';
var assign = require('core-js/modules/$.assign');
var assign = require('core-js/modules/$.object-assign');
var proxyquire = require('proxyquire');
var errors = require('../lib/errors');
@@ -136,6 +136,15 @@ describe('TabState', function () {
assert.equal(request.url, "http://example.com/badge?uri=tabUrl");
});
it('urlencodes the tabUrl appropriately', function() {
state.updateAnnotationCount("tabId", "http://foo.com?bar=baz qüx", "http://example.com");
assert.equal(server.requests.length, 1);
var request = server.requests[0];
assert.equal(request.method, "GET");
assert.equal(request.url, "http://example.com/badge?uri=http%3A%2F%2Ffoo.com%3Fbar%3Dbaz+q%C3%BCx");
});
it("doesn't set the annotation count if the server's JSON is invalid", function() {
server.respondWith(
"GET", "http://example.com/badge?uri=tabUrl",
Oops, something went wrong.

No commit comments for this range