• Robert Knight's avatar
    Update the displayed annotation timestamp immediately after creation/update · 37e2407a
    Robert Knight authored
    There were two problems here:
    
     1. The periodic interval for updating the timestamp was never started
        for new annotations because the initial call to updateTimestamp()
        was a no-op for annotations that had no timestamp yet.
    
     2. domainModel.updated was never updated after an annotation
        was saved to the server and hence the call to
        updateTimestamp() re-used the old timestamp.
    
    (1) is fixed now by restarting the interval using the current
    last-updated timestamp whenever the view model is updated.
    
    (2) is fixed indirectly now by moving the logic to update
    the timestamp into updateViewModel(), so that all updates
    to it happen in one place. When an annotation is updated,
    the updated domain model returned by the server is the one
    passed into updateViewModel() to update it.
    
     * Separate out the logic for creating a decaying interval
       whose frequency depends on the age of some input timestamp,
       and updating the timestamp string on each interval.
    
       The decaying interval is now handled by 'time.decayingInterval'
    
     * Trigger a restart of the interval whenever the view model is
       updated in response to a change to the annotation
    
    Fixes #2819
    Fixes #2822
    37e2407a
Name
Last commit
Last update
h Loading commit data...
scripts Loading commit data...
.hound.yml Loading commit data...
.jscsrc Loading commit data...
.jshintignore Loading commit data...
.jshintrc Loading commit data...
package.json Loading commit data...