diff options
author | Vitaly Takmazov | 2023-01-18 11:39:05 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2023-01-18 11:39:05 +0300 |
commit | 118464cfdabdad2b943e959e14ceb3012642a301 (patch) | |
tree | 6b5af9ecccaabc422478a2739667bc50380bf396 /src/main/java/com/juick/service/SubscriptionServiceImpl.java | |
parent | 1c96e74ad675c3a7d1b6ab2bb01307a94b8d4212 (diff) |
Drop unused `useroptions` table
Diffstat (limited to 'src/main/java/com/juick/service/SubscriptionServiceImpl.java')
-rw-r--r-- | src/main/java/com/juick/service/SubscriptionServiceImpl.java | 42 |
1 files changed, 1 insertions, 41 deletions
diff --git a/src/main/java/com/juick/service/SubscriptionServiceImpl.java b/src/main/java/com/juick/service/SubscriptionServiceImpl.java index 2e475256..d6e97010 100644 --- a/src/main/java/com/juick/service/SubscriptionServiceImpl.java +++ b/src/main/java/com/juick/service/SubscriptionServiceImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008-2020, Juick + * Copyright (C) 2008-2023, Juick * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as @@ -20,7 +20,6 @@ package com.juick.service; import com.juick.model.Message; import com.juick.model.Tag; import com.juick.model.User; -import com.juick.model.NotifyOpts; import com.juick.util.MessageUtils; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.IteratorUtils; @@ -34,7 +33,6 @@ import org.springframework.transaction.annotation.Transactional; import javax.annotation.Nonnull; import javax.inject.Inject; import java.util.Collections; -import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.stream.Collectors; @@ -198,42 +196,4 @@ public class SubscriptionServiceImpl extends BaseJdbcService implements Subscrip "ON(tags.tag_id = subscr_tags.tag_id) " + "WHERE subscr_tags.suser_id=? ORDER BY tags.name", String.class, user.getUid()); } - - @Transactional(readOnly = true) - @Override - public NotifyOpts getNotifyOptions(final User user) { - List<NotifyOpts> list = getJdbcTemplate().query( - "SELECT jnotify,subscr_notify,recommendations FROM useroptions WHERE user_id=?", - (rs, num) -> { - NotifyOpts options = new NotifyOpts(); - options.setRepliesEnabled(rs.getInt(1) > 0); - options.setSubscriptionsEnabled(rs.getInt(2) > 0); - options.setRecommendationsEnabled(rs.getInt(3) > 0); - return options; - }, - user.getUid()); - - return list.isEmpty() ? new NotifyOpts() : list.get(0); - } - - @Transactional - @Override - public boolean setNotifyOptions(final User user, final NotifyOpts options) { - int jnotify = getJdbcTemplate().update( - "UPDATE useroptions SET jnotify=? WHERE user_id=?", - options.isRepliesEnabled() ? 1 : 0, - user.getUid()); - - int subscr_notify = getJdbcTemplate().update( - "UPDATE useroptions SET subscr_notify=? WHERE user_id=?", - options.isSubscriptionsEnabled() ? 1 : 0, - user.getUid()); - - int recommendations = getJdbcTemplate().update( - "UPDATE useroptions SET recommendations=? WHERE user_id=?", - options.isRecommendationsEnabled() ? 1 : 0, - user.getUid()); - - return jnotify > 0 && subscr_notify > 0 && recommendations > 0; - } } |