aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-04-17 16:01:28 +0300
committerGravatar Vitaly Takmazov2023-04-17 16:01:28 +0300
commit106c53cce6725591337773d412c0fb74eaf81ed8 (patch)
treefe07a0136c63787d6e5f53349af16541faebaf89 /src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java
parentcf3a5d8c979b114fceef43b35541b941bcbd62a1 (diff)
Add/remove from whitelist on web
Diffstat (limited to 'src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java')
-rw-r--r--src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java b/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java
index 437c9f8c..d954df09 100644
--- a/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java
+++ b/src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java
@@ -60,4 +60,20 @@ public class PrivacyQueriesServiceImpl extends BaseJdbcService implements Privac
return PrivacyResult.Added;
}
+
+ @Override
+ public PrivacyResult whiteListUser(User user, User target) {
+ int result = getJdbcTemplate().update(
+ "DELETE FROM wl_users WHERE user_id = ? AND wl_user_id = ?",
+ user.getUid(), target.getUid());
+
+ if (result > 0)
+ return PrivacyResult.Removed;
+
+ getJdbcTemplate().update(
+ "INSERT INTO wl_users(user_id, wl_user_id) VALUES (?, ?)",
+ user.getUid(), target.getUid());
+
+ return PrivacyResult.Added;
+ }
}