Commit 009d7687 authored by Robert Knight's avatar Robert Knight

Merge pull request #2682 from hypothesis/remove-pulse-remnants

Remove the remnants of a defunct annotation pulse feature
parents f8442789 a0f94df6
......@@ -147,7 +147,6 @@ module.exports = angular.module('h', [
.service('host', require('./host'))
.service('localStorage', require('./local-storage'))
.service('permissions', require('./permissions'))
.service('pulse', require('./pulse'))
.service('queryParser', require('./query-parser'))
.service('render', require('./render'))
.service('searchFilter', require('./search-filter'))
......
......@@ -361,11 +361,6 @@ AnnotationController = [
# Discard saved drafts
drafts.remove model
# Propagate an update event up the thread (to pulse changing threads),
# but only if this is someone else's annotation.
if model.user != session.state.userid
$scope.$emit('annotationUpdate')
# Save highlights once logged in.
if this.isHighlight() and highlight
if model.user and not model.id
......
......@@ -382,24 +382,6 @@ describe 'annotation', ->
$document.click()
assert.notOk(dialog.hasClass('open'))
describe 'annotationUpdate event', ->
beforeEach ->
createDirective()
sandbox.spy(isolateScope, '$emit')
annotation.updated = '123'
$scope.$digest()
it "does not fire when this user's annotations are updated", ->
annotation.updated = '456'
$scope.$digest()
assert.notCalled(isolateScope.$emit)
it "fires when another user's annotation is updated", ->
fakeSession.state.userid = 'acct:jane@localhost'
annotation.updated = '456'
$scope.$digest()
assert.calledWith(isolateScope.$emit, 'annotationUpdate')
describe "deleteAnnotation() method", ->
before ->
sinon.stub(window, "confirm")
......
......@@ -6,7 +6,6 @@ describe 'thread', ->
$scope = null
controller = null
fakeGroups = null
fakePulse = null
fakeRender = null
fakeAnnotationUI = null
sandbox = null
......@@ -29,7 +28,6 @@ describe 'thread', ->
fakeGroups = {
focused: sandbox.stub().returns({id: '__world__'})
}
fakePulse = sandbox.spy()
fakeRender = sandbox.spy()
fakeAnnotationUI = {
hasSelectedAnnotations: ->
......@@ -38,7 +36,6 @@ describe 'thread', ->
selectedAnnotations.indexOf(id) != -1
}
$provide.value 'groups', fakeGroups
$provide.value 'pulse', fakePulse
$provide.value 'render', fakeRender
$provide.value 'annotationUI', fakeAnnotationUI
return
......@@ -351,31 +348,3 @@ describe 'thread', ->
controller.container = {}
assert.isFalse(controller.matchesFilter())
assert.calledWith(check, controller.container)
describe 'directive', ->
beforeEach ->
createDirective()
it 'pulses the current thread on an annotationUpdated event', ->
$element.scope().$emit('annotationUpdate')
assert.called(fakePulse)
it 'does not pulse the thread if it is hidden (parent collapsed)', ->
fakeParent = {
controller: -> {collapsed: true}
}
sandbox.stub(angular.element.prototype, 'parent').returns(fakeParent)
$element.scope().$emit('annotationUpdate')
assert.notCalled(fakePulse)
it 'does not pulse the thread if it is hidden (grandparent collapsed)', ->
fakeGrandParent = {
controller: -> {collapsed: true}
}
fakeParent = {
controller: -> {collapsed: false}
parent: -> fakeGrandParent
}
sandbox.stub(angular.element.prototype, 'parent').returns(fakeParent)
$element.scope().$emit('annotationUpdate')
assert.notCalled(fakePulse)
......@@ -219,8 +219,8 @@ isHiddenThread = (elem) ->
# Directive that instantiates {@link thread.ThreadController ThreadController}.
###
module.exports = [
'$parse', '$window', '$location', '$anchorScroll', 'pulse', 'render',
($parse, $window, $location, $anchorScroll, pulse, render) ->
'$parse', '$window', '$location', '$anchorScroll', 'render',
($parse, $window, $location, $anchorScroll, render) ->
linkFn = (scope, elem, attrs, [ctrl, counter, filter]) ->
# We would ideally use require for this, but searching parents only for a
......@@ -239,15 +239,6 @@ module.exports = [
counter.count 'message', 1
scope.$on '$destroy', -> counter.count 'message', -1
# Flash the thread when any child annotations are updated.
scope.$on 'annotationUpdate', (event) ->
# If we're hidden, we let the event propagate up to the parent thread.
if isHiddenThread(elem)
return
# Otherwise, stop the event from bubbling, and pulse this thread.
event.stopPropagation()
pulse(elem)
# The watch is necessary because the computed value of the attribute
# expression may change. This won't happen when we use the thread
# directive in a repeat, since the element will be torn down whenever the
......
###*
# @ngdoc service
# @name pulse
# @param {Element} elem Element to pulse.
# @description
# Pulses an element to indicate activity in that element.
###
module.exports = ['$animate', ($animate) ->
(elem) ->
$animate.addClass elem, 'pulse', ->
$animate.removeClass(elem, 'pulse')
]
......@@ -28,14 +28,6 @@ $thread-padding: 1em;
margin-left: -$thread-padding;
}
@keyframes pulse {
10% { background-color: #ffc; }
}
&.pulse {
animation: pulse 1200ms ease-in-out;
}
.thread {
border-left: 1px dotted $gray-light;
padding: 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment