2020import com .stacksync .commons .models .User ;
2121import com .stacksync .commons .models .UserWorkspace ;
2222import com .stacksync .commons .models .Workspace ;
23+ import com .stacksync .commons .notifications .CommitNotification ;
2324import com .stacksync .syncservice .db .ConnectionPool ;
2425import com .stacksync .syncservice .db .DAOFactory ;
2526import com .stacksync .syncservice .db .DeviceDAO ;
@@ -72,7 +73,7 @@ public Handler(ConnectionPool pool) throws SQLException, NoStorageManagerAvailab
7273 storageManager = StorageFactory .getStorageManager (StorageType .SWIFT );
7374 }
7475
75- public List < CommitInfo > doCommit (User user , Workspace workspace , Device device , List <ItemMetadata > items )
76+ public CommitNotification doCommit (User user , Workspace workspace , Device device , List <ItemMetadata > items )
7677 throws DAOException {
7778
7879 HashMap <Long , Long > tempIds = new HashMap <Long , Long >();
@@ -83,7 +84,9 @@ public List<CommitInfo> doCommit(User user, Workspace workspace, Device device,
8384
8485 device = deviceDao .get (device .getId ());
8586 // TODO: check if the device belongs to the user
86-
87+
88+ user = userDao .findById (user .getId ());
89+
8790 List <CommitInfo > responseObjects = new ArrayList <CommitInfo >();
8891
8992 for (ItemMetadata item : items ) {
@@ -92,7 +95,6 @@ public List<CommitInfo> doCommit(User user, Workspace workspace, Device device,
9295 boolean committed ;
9396
9497 try {
95- user = userDao .findById (user .getId ());
9698 if (item .getParentId () != null ) {
9799 Long parentId = tempIds .get (item .getParentId ());
98100 if (parentId != null ) {
@@ -135,7 +137,7 @@ public List<CommitInfo> doCommit(User user, Workspace workspace, Device device,
135137 responseObjects .add (new CommitInfo (item .getVersion (), committed , objectResponse ));
136138 }
137139
138- return responseObjects ;
140+ return new CommitNotification ( null , responseObjects , user . getQuotaLimit (), user . getQuotaUsedLogical ()) ;
139141 }
140142
141143 public Workspace doShareFolder (User user , List <String > emails , Item item , boolean isEncrypted )
0 commit comments