• Sean Hammond's avatar
    Keep permissions of new annotations in sync when changing group · 4ff2c56f
    Sean Hammond authored
    Keep the permissions of new annotations in sync with the group, when
    changing the focused group.
    
    This fixes an issue where a new (not yet saved to server) shared
    annotation in group Foo would become a private annotation if you changed
    the focused group to Bar.
    
    The issue is that model/@annotation.group gets changed to Foo, but
    model/@annotation.permissions still contains a permissions object with
    group Bar's ID in it, and as a result the permissions service thinks
    that it is a private annotation.
    
    The fix is to update both .group and .permissions when the focused group
    changes, and to update the drafts service _after_ doing this not before
    (otherwise a copy of the annotation containing the previous group's ID
    gets saved to the drafts service, and then later gets read from the
    drafts service and overwrites the correct data).
    
    Fixes #2713.
    4ff2c56f
annotation.coffee 17.5 KB