• Sean Hammond's avatar
    Add vm.isPrivate boolean · 1f4718b7
    Sean Hammond authored
    Recent changes broke the reverting of unsaved changes to annotations
    (AnnotationController.vm.revert()) when the user presses the _Cancel_ button on
    the annotation editor. The annotation's privacy was not being restored to its
    previously saved value.
    
    We can't set domainModel.permissions when the user changes the privacy of an
    annotation that they're editing, because if the user clicks _Cancel_ we need
    to revert the privacy back to its previous value (which we've just overwriten).
    
    So instead add a new vm.isPrivate boolean and set that instead:
    
    - vm.isPrivate() method (which returned true or false based on the value of
      domainModel.permissions) is replaced with a vm.isPrivate boolean.
    
    - updateViewModel() now sets vm.isPrivate according to the value of
      domainModel.permissions.
    
    - updatedDomainModel() nows sets domainModel.permissions according to the
      value of vm.isPrivate.
    
    - setPrivacy() nows sets vm.isPrivate instead of domainModel.permissions.
    
    - We no longer change domainModel.permissions when the focused group
      changes (it will continue to hold shared permissions for the previous group,
      but these will be updated by updatedDomainModel() before saving them to the
      server).
    
      vm.isPrivate doesn't need to be changed when the focused group changes
      because its value is independent of the focused group.
    
    - saveToDrafts() now saves vm.isPrivate instead of vm.isPrivate()
    
    - restoreFromDrafts() now restores vm.isPrivate instead of
      domainModel.permissions
    1f4718b7
Name
Last commit
Last update
..
client Loading commit data...