aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/service
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/service')
-rw-r--r--src/main/java/com/juick/service/PrivacyQueriesService.java2
-rw-r--r--src/main/java/com/juick/service/PrivacyQueriesServiceImpl.java16
2 files changed, 18 insertions, 0 deletions
diff --git a/src/main/java/com/juick/service/PrivacyQueriesService.java b/src/main/java/com/juick/service/PrivacyQueriesService.java
index 68c157f6..f1b9915d 100644
--- a/src/main/java/com/juick/service/PrivacyQueriesService.java
+++ b/src/main/java/com/juick/service/PrivacyQueriesService.java
@@ -35,4 +35,6 @@ public interface PrivacyQueriesService {
@CacheEvict(value = { "discussions", "messages", "replies" }, allEntries = true)
PrivacyResult blacklistTag(User user, Tag tag);
+
+ PrivacyResult whiteListUser(User user, User target);
}
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;
+ }
}