Skip to content

Commit

Permalink
Fix annotation thread collapsing
Browse files Browse the repository at this point in the history
This was broken by all the recent annotation directive refactoring:
annotation threads are now shown uncollapsed by default (should be
collapsed) and the buttons to collapse/uncollapse them do nothing.

vm/ctrl.editing became a method vm/ctrl.editing() but some code in the
link function wasn't updated.

This fixes them to be collapsed by default and gets the
collapse/uncollapse buttons working but I'm not sure if the collapse
behaviour is correct with nested threads.

Fixes #2823.
  • Loading branch information
seanh committed Jan 12, 2016
1 parent bdb41f1 commit b8f11c1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions h/static/scripts/directive/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -805,13 +805,13 @@ function annotation($document) {
scope.$watch((function() {
counter.count('edit');
}), function(count) {
if (count && !ctrl.editing && thread.collapsed) {
if (count && !ctrl.editing() && thread.collapsed) {
thread.toggleCollapsed();
}
});

// Propagate changes through the counters.
scope.$watch((function() {return ctrl.editing;}), function(editing, old) {
scope.$watch((function() {return ctrl.editing();}), function(editing, old) {
if (editing) {
counter.count('edit', 1);
// Disable the filter and freeze it to always match while editing.
Expand All @@ -829,7 +829,7 @@ function annotation($document) {

// Clean up when the thread is destroyed.
scope.$on('$destroy', function() {
if (ctrl.editing && counter) {
if (ctrl.editing() && counter) {
counter.count('edit', -1);
}
});
Expand Down

0 comments on commit b8f11c1

Please sign in to comment.