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
  • 11 commits
  • 14 files changed
  • 0 commit comments
  • 2 contributors
Commits on Oct 27, 2015
Avoid reloading whole view when groups list changes
When the client receives a notification that the
list of groups changes, update just the groups list
and, if necessary, focused group rather than reloading
the whole view.

This is done by splitting the SESSION_CHANGED event
into finer-grained GROUPS_CHANGED and USER_CHANGED
events. The <groups-list> directive now listens for
GROUPS_CHANGED and updates itself in response.

This fixes an issue where joining or leaving a group
would always result in unsaved changes to annotation text
being lost.

If the user leaves a group which is currently focused and
which has an unsaved changes to an annotation, that will still
result in changes to the annotation being lost.

 * Add finer-grained GROUPS_CHANGED and USER_CHANGED
   events which components can react to.

 * Avoid directly exposing the groups service to the
   <group-list> template and instead only expose
   the required methods. This makes it easier to
   track what is going on in the template.

Fixes #2641
Fix groups list not updating after initial login
When the <groups-list> directive is instantiated,
login is not complete and the groups list contains only
the Public group.

Once the login completes, the groups list was updated
because GROUPS_CHANGED was not broadcast for the initial
groups load. The reason for this was to avoid an unnecessary
route reload in `AppController`.

Resolve this by always firing the `SESSION_CHANGED`,
`USER_CHANGED` and `GROUPS_CHANGED` events when
they change, but include an additional piece of data
indicating whether this is the first load or not. This is used
in `AppController` to avoid an unnecessary route reload.
Commits on Oct 28, 2015
Fix minor visual regression on help pages
A style for anchor tags was moved from `common.scss` to `elements.scss`,
and so we now need to include that here.
Simplify how <groups-list> updates when the groups list changes.
Avoid maintaining a copy of the groups list and focused group
states in the directive as per the discussion at
https://hypothes-is.slack.com/archives/public/p1446048142004464
Encode semicolons in query parameters
Angular 1.4.x introduced a breaking change (undocumented in the
upgrading guide as far as I can tell) to the way URL query parameters
are handled in ajax requests.

Specifically, semicolons in query parameter values are no longer encoded
by default. This causes problems for us in request urls such as

    /api/search?uri=http:%2F%2Fexample.com/?id=4;display=print

because Pyramid interprets the semicolon (correctly according to
RFC3986) as a query string delimiter.

This commit fixes the issue by overriding the default parameter
serializer (although only for the ngResource objects in the store
service) with a much more conservative one that encodes everything with
`encodeURIComponent`.

The bulk of the code here is a slightly modified version of the default
serializer used by Angular.
Merge pull request #2674 from robertknight/gh2641-no_reload_on_groups…
…_list_change

Avoid route reload on groups list change
Commits on Oct 29, 2015
Fix exception when GROUPS_CHANGED event is broadcast during route load
The <group-list> directive attempted to update itself in
response to a group change notification without triggering
a full digest cycle by using `$scope.$apply`.

This was based on the incorrect understanding that $apply only
dirty-checks the current scope downwards. In fact, in dirty-checks
the root scope. Additionally, the logic was pointless since
group list/focus changes happen in response to two types of events,
both of which are triggered in the context of $apply:

 * An event handler when the user selects a group

 * A callback from angular-websocket when a WebSocket message
   is received.
View
@@ -1,3 +1,61 @@
0.7.19 (2015-10-28)
==================
Bug fixes
---------
- Fix a problem where an incorrect search query was sent to our server due to
semicolons in the page URL (6513184).
0.7.9 (2015-10-28)
==================
Bug fixes
---------
- Fix a problem where activating the Chrome extension would obliterate a version
of Hypothesis embedded on the page (#2657).
- Fix a visual issue causing the "Clear selection" and "Clear search" buttons to
be briefly visible when they shouldn't have been (#2668).
- Fix a crash triggered when the set of connected WebSocket clients changed
while handling a message (#2647).
- Fix a bug where cancelling leaving a group nonetheless resulted in group focus
changing (#2669).
Features
--------
- Improved appearance and behaviour of the sort control for annotations (feature
flagged: groups) (#2643).
- Replies now inherit the publication scope of their parents. That is: replies
to group annotations will go to the same group (#2650).
- Support HTTP conditional responses (ETag/If-None-Match and
Last-Modified/If-Modified-Since) under appropriate conditions (#2664).
- Groups landing pages now show a list of recently annotated pages (feature
flagged: groups) (#2667).
Miscellanea
-----------
- Upgrade to Angular 1.4.7 (#2629).
- Account settings and profile forms are now rendered by the server (#2636).
- The Chrome extension can now be built in a way that allows distinguishing
between development versions of the extension and production ones (#2639).
- No longer perform the URI expansion step when searching for annotations on
URLs which have been marked "canonical". This hopefully reduces the number of
false-positive annotations we load on pages with appropriate metadata (#2652).
- Replace group public IDs (hashids) with randomly generated IDs (#2662).
0.7.8 (2015-10-20)
==================
@@ -48,10 +48,11 @@ module.exports = class AppController
# Reload the view when the focused group changes or the
# list of groups that the user is a member of changes
reloadEvents = [events.SESSION_CHANGED, events.GROUP_FOCUSED];
reloadEvents = [events.USER_CHANGED, events.GROUP_FOCUSED];
reloadEvents.forEach((eventName) ->
$scope.$on(eventName, (event) ->
$route.reload()
$scope.$on(eventName, (event, data) ->
if !data || !data.initialLoad
$route.reload()
)
);
@@ -1,7 +1,9 @@
'use strict';
var events = require('../events');
// @ngInject
function GroupListController($scope, $window) {
function GroupListController($scope, $window, groups) {
$scope.expandedGroupId = undefined;
// show the share link for the specified group or clear it if
@@ -19,13 +21,17 @@ function GroupListController($scope, $window) {
};
$scope.leaveGroup = function (groupId) {
var groupName = $scope.groups.get(groupId).name;
var groupName = groups.get(groupId).name;
var message = 'Are you sure you want to leave the group "' +
groupName + '"?';
if ($window.confirm(message)) {
$scope.groups.leave(groupId);
groups.leave(groupId);
}
}
$scope.focusGroup = function (groupId) {
groups.focus(groupId);
}
}
/**
@@ -1,5 +1,6 @@
'use strict';
var events = require('../../events');
var groupList = require('../group-list');
var util = require('./util');
@@ -8,8 +9,16 @@ describe('GroupListController', function () {
var $scope;
beforeEach(function () {
$scope = {};
controller = new groupList.Controller($scope);
$scope = {
$on: sinon.stub(),
$apply: sinon.stub(),
};
var fakeWindow = {};
var fakeGroups = {
all: sinon.stub(),
focused: sinon.stub(),
};
controller = new groupList.Controller($scope, fakeWindow, fakeGroups);
});
it('toggles share links', function () {
@@ -44,19 +53,12 @@ function isElementHidden(element) {
}
describe('groupList', function () {
var $rootScope;
var $window;
var GROUP_LINK = 'https://hypothes.is/groups/hdevs';
var groups = [{
id: 'public',
public: true
},{
id: 'h-devs',
name: 'Hypothesis Developers',
url: GROUP_LINK
}];
var groups;
var fakeGroups;
before(function() {
@@ -72,9 +74,19 @@ describe('groupList', function () {
angular.mock.module('h.templates');
});
beforeEach(angular.mock.inject(function (_$window_) {
beforeEach(angular.mock.inject(function (_$rootScope_, _$window_) {
$rootScope = _$rootScope_;
$window = _$window_;
groups = [{
id: 'public',
public: true
},{
id: 'h-devs',
name: 'Hypothesis Developers',
url: GROUP_LINK
}];
fakeGroups = {
all: function () {
return groups;
@@ -87,6 +99,7 @@ describe('groupList', function () {
},
leave: sinon.stub(),
focus: sinon.stub(),
focused: sinon.stub(),
};
}));
@@ -2,10 +2,13 @@
* This module defines the set of global events that are dispatched
* on $rootScope
*/
module.exports = {
/** Broadcast when the currently selected group changes */
GROUP_FOCUSED: 'groupFocused',
/** Broadcast when the list of groups changes */
GROUPS_CHANGED: 'groupsChanged',
/** Broadcast when the signed-in user changes */
USER_CHANGED: 'userChanged',
/** Broadcast when the session state is updated.
* This event is NOT broadcast after the initial session load.
*/
@@ -84,7 +84,7 @@ function groups(localStorage, session, $rootScope, features, $http) {
}
// reset the focused group if the user leaves it
$rootScope.$on(events.SESSION_CHANGED, function () {
$rootScope.$on(events.GROUPS_CHANGED, function () {
if (focusedGroup) {
focusedGroup = get(focusedGroup.id);
if (!focusedGroup) {
@@ -116,6 +116,9 @@ function session($document, $http, $resource, $rootScope, flash) {
resource.update = function (model) {
var isInitialLoad = !resource.state.csrf;
var userChanged = model.userid !== resource.state.userid;
var groupsChanged = !angular.equals(model.groups, resource.state.groups);
// Copy the model data (including the CSRF token) into `resource.state`.
angular.copy(model, resource.state);
@@ -128,8 +131,19 @@ function session($document, $http, $resource, $rootScope, flash) {
lastLoad = {$promise: Promise.resolve(model), $resolved: true};
lastLoadTime = Date.now();
if (!isInitialLoad) {
$rootScope.$broadcast(events.SESSION_CHANGED);
$rootScope.$broadcast(events.SESSION_CHANGED, {
initialLoad: isInitialLoad,
});
if (userChanged) {
$rootScope.$broadcast(events.USER_CHANGED, {
initialLoad: isInitialLoad,
});
}
if (groupsChanged) {
$rootScope.$broadcast(events.GROUPS_CHANGED, {
initialLoad: isInitialLoad,
});
}
// Return the model
View
@@ -24,6 +24,56 @@ function stripInternalProperties(obj) {
return result;
}
function forEachSorted(obj, iterator, context) {
var keys = Object.keys(obj).sort();
for (var i = 0; i < keys.length; i++) {
iterator.call(context, obj[keys[i]], keys[i]);
}
return keys;
}
function serializeValue(v) {
if (angular.isObject(v)) {
return angular.isDate(v) ? v.toISOString() : angular.toJson(v);
}
return v;
}
function encodeUriQuery(val) {
return encodeURIComponent(val).replace(/%20/g, '+');
}
// Serialize an object containing parameters into a form suitable for a query
// string.
//
// This is an almost identical copy of the default Angular parameter serializer
// ($httpParamSerializer), with one important change. In Angular 1.4.x
// semicolons are not encoded in query parameter values. This is a problem for
// us as URIs around the web may well contain semicolons, which our backend will
// then proceed to parse as a delimiter in the query string. To avoid this
// problem we use a very conservative encoder, found above.
function serializeParams(params) {
if (!params) return '';
var parts = [];
forEachSorted(params, function(value, key) {
if (value === null || typeof value === 'undefined') return;
if (angular.isArray(value)) {
angular.forEach(value, function(v, k) {
parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(v)));
});
} else {
parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value)));
}
});
return parts.join('&');
}
/**
* @ngdoc factory
* @name store
@@ -41,6 +91,7 @@ function stripInternalProperties(obj) {
function store($http, $resource, settings) {
var instance = {};
var defaultOptions = {
paramSerializer: serializeParams,
transformRequest: prependTransform(
$http.defaults.transformRequest,
stripInternalProperties
@@ -54,9 +105,15 @@ function store($http, $resource, settings) {
.then(function (response) {
var links = response.data.links;
instance.SearchResource = $resource(links.search.url, {}, defaultOptions);
// N.B. in both cases below we explicitly override the default `get`
// action because there is no way to provide defaultOptions to the default
// action.
instance.SearchResource = $resource(links.search.url, {}, {
get: angular.extend({url: links.search.url}, defaultOptions),
});
instance.AnnotationResource = $resource(links.annotation.read.url, {}, {
get: angular.extend(links.annotation.read, defaultOptions),
create: angular.extend(links.annotation.create, defaultOptions),
update: angular.extend(links.annotation.update, defaultOptions),
delete: angular.extend(links.annotation.delete, defaultOptions),
@@ -151,8 +151,14 @@ describe 'AppController', ->
$scope.$broadcast(events.GROUP_FOCUSED)
assert.calledOnce(fakeRoute.reload)
it 'reloads the view when the session state changes', ->
it 'does not reload the view when the logged-in user changes on first load', ->
createController()
fakeRoute.reload = sinon.spy()
$scope.$broadcast(events.SESSION_CHANGED)
$scope.$broadcast(events.USER_CHANGED, {initialLoad: true})
assert.notCalled(fakeRoute.reload)
it 'reloads the view when the logged-in user changes after first load', ->
createController()
fakeRoute.reload = sinon.spy()
$scope.$broadcast(events.USER_CHANGED, {initialLoad: false})
assert.calledOnce(fakeRoute.reload)
@@ -40,7 +40,7 @@ describe('groups', function() {
$broadcast: sandbox.stub(),
$on: function(event, callback) {
if (event === events.SESSION_CHANGED) {
if (event === events.GROUPS_CHANGED) {
this.eventCallbacks.push(callback);
}
}
Oops, something went wrong.

No commit comments for this range