jmuehlner commented on code in PR #970:
URL: https://github.com/apache/guacamole-client/pull/970#discussion_r1563254941


##########
guacamole/src/main/frontend/src/app/history/services/guacHistory.js:
##########
@@ -42,6 +42,31 @@ angular.module('history').factory('guacHistory', 
['$injector',
      */
     service.recentConnections = [];
 
+    /**
+     * Remove from the list of connection history the item having the given
+     * identfier.
+     * 
+     * @param {String} id
+     *     The identifier of the item to remove from the history list.
+     *     
+     * @returns {boolean}
+     *     True if the removal was successful, otherwise false.
+     */
+    service.removeEntry = function removeEntry(id) {
+    
+        var i;
+        
+        for (i = 0; i < service.recentConnections.length; i++) {
+            if (service.recentConnections[i].id === id) {

Review Comment:
   This definitely works fine. That said, we do have access to lodash in the 
webapp, which makes these sorts of operations a bit less clunky. 
   
   For example, the contents of this function could be replaced by 
   
   ```
   return _.remove(service.recentConnections, entry => entry.id === id).length 
> 0;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to