aicam commented on code in PR #3710:
URL: https://github.com/apache/texera/pull/3710#discussion_r2320650206


##########
core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/hub/HubResource.scala:
##########
@@ -214,30 +200,30 @@ object HubResource {
         .set(idColumn, entityId)
         .execute()
 
-      recordUserActivity(request, userId, entityId, entityType, Like)
+      recordUserAction(request, userId, entityId, entityType, Like)

Review Comment:
   If you change the return of `recordUserAction` to boolean, you can simply 
return the output of that so no need to write `true` and `false` manually and 
the code will be cleaner



##########
core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/hub/ActionType.scala:
##########
@@ -46,4 +47,10 @@ object ActionType {
       .getOrElse(
         throw new IllegalArgumentException(s"Unsupported actionType '$s'")
       )
+
+  def toActionEnum(a: ActionType): ActionEnum = {
+    ActionEnum.values()
+      .find(_.getLiteral.equalsIgnoreCase(a.value))
+      .getOrElse(throw new IllegalArgumentException(s"Unsupported action: 
${a.value}"))

Review Comment:
   Don't throw an error here since this process is not supposed to be blocker, 
return `unknown` and log the unsupported action so application does not crash



##########
core/amber/src/main/scala/edu/uci/ics/texera/web/resource/dashboard/hub/HubResource.scala:
##########
@@ -149,46 +134,47 @@ object HubResource {
   }
 
   /**
-    * Records a user's activity in the system.
+    * Records a user's action in the system.
     *
     * @param request The HTTP request object to extract the user's IP address.
     * @param userId The ID of the user performing the action (default is 0 for 
anonymous users).
     * @param entityId The ID of the entity associated with the action.
     * @param entityType The type of entity being acted upon (validated before 
processing).
     * @param action The action performed by the user ("like", "unlike", 
"view", "clone").
     */
-  def recordUserActivity(
+  def recordUserAction(
       request: HttpServletRequest,
       userId: Integer = Integer.valueOf(0),
       entityId: Integer,
       entityType: EntityType,
       action: ActionType
   ): Unit = {

Review Comment:
   This function is returning boolean, why the type of output is Unit?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to