From 118464cfdabdad2b943e959e14ceb3012642a301 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 18 Jan 2023 11:39:05 +0300 Subject: Drop unused `useroptions` table --- src/main/java/com/juick/model/NotifyOpts.java | 51 -------- .../com/juick/service/ShowQueriesServiceImpl.java | 11 +- .../com/juick/service/SubscriptionService.java | 8 +- .../com/juick/service/SubscriptionServiceImpl.java | 42 +------ .../java/com/juick/service/TagServiceImpl.java | 7 +- .../com/juick/service/TelegramServiceImpl.java | 3 +- src/main/java/com/juick/service/UserService.java | 12 +- .../java/com/juick/service/UserServiceImpl.java | 140 ++++++--------------- .../java/com/juick/www/controllers/Settings.java | 15 --- .../db/migration/V1.34__drop_useroptions.sql | 1 + .../resources/templates/views/settings_main.html | 12 -- 11 files changed, 51 insertions(+), 251 deletions(-) delete mode 100644 src/main/java/com/juick/model/NotifyOpts.java create mode 100644 src/main/resources/db/migration/V1.34__drop_useroptions.sql (limited to 'src') diff --git a/src/main/java/com/juick/model/NotifyOpts.java b/src/main/java/com/juick/model/NotifyOpts.java deleted file mode 100644 index 8d65a0ff..00000000 --- a/src/main/java/com/juick/model/NotifyOpts.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2008-2020, 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 - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package com.juick.model; - -/** - * Created by vt on 03/09/16. - */ -public class NotifyOpts { - private boolean repliesEnabled; - private boolean subscriptionsEnabled; - private boolean recommendationsEnabled; - - public boolean isRepliesEnabled() { - return repliesEnabled; - } - - public void setRepliesEnabled(boolean repliesEnabled) { - this.repliesEnabled = repliesEnabled; - } - - public boolean isSubscriptionsEnabled() { - return subscriptionsEnabled; - } - - public void setSubscriptionsEnabled(boolean subscriptionsEnabled) { - this.subscriptionsEnabled = subscriptionsEnabled; - } - - public boolean isRecommendationsEnabled() { - return recommendationsEnabled; - } - - public void setRecommendationsEnabled(boolean recommendationsEnabled) { - this.recommendationsEnabled = recommendationsEnabled; - } -} diff --git a/src/main/java/com/juick/service/ShowQueriesServiceImpl.java b/src/main/java/com/juick/service/ShowQueriesServiceImpl.java index 426ed9f2..15e8f875 100644 --- a/src/main/java/com/juick/service/ShowQueriesServiceImpl.java +++ b/src/main/java/com/juick/service/ShowQueriesServiceImpl.java @@ -51,12 +51,11 @@ public class ShowQueriesServiceImpl extends BaseJdbcService implements ShowQueri @Override public List getTopUsers() { - return getJdbcTemplate().query( - "SELECT users.nick,COUNT(subscr_users.suser_id) AS cnt " + - "FROM (subscr_users INNER JOIN users ON subscr_users.user_id=users.id) " + - "INNER JOIN useroptions ON users.id=useroptions.user_id " + - "WHERE useroptions.privacy_view>0 AND users.lastmessage > UNIX_TIMESTAMP() - 259200 " + - "AND users.id!=2 GROUP BY subscr_users.user_id ORDER BY cnt DESC LIMIT 10", + return getJdbcTemplate().query(""" + SELECT users.nick,COUNT(subscr_users.suser_id) AS cnt + FROM (subscr_users INNER JOIN users ON subscr_users.user_id=users.id) + WHERE users.lastmessage > UNIX_TIMESTAMP() - 259200 + AND users.id!=2 GROUP BY subscr_users.user_id ORDER BY cnt DESC LIMIT 10""", (rs, rowNum) -> rs.getString(1)); } } diff --git a/src/main/java/com/juick/service/SubscriptionService.java b/src/main/java/com/juick/service/SubscriptionService.java index 96735d1a..b80632a0 100644 --- a/src/main/java/com/juick/service/SubscriptionService.java +++ b/src/main/java/com/juick/service/SubscriptionService.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 @@ -23,8 +23,6 @@ import com.juick.model.User; import org.springframework.cache.annotation.CacheEvict; -import com.juick.model.NotifyOpts; - import java.util.List; /** @@ -54,8 +52,4 @@ public interface SubscriptionService { boolean unSubscribeTag(User user, Tag toTag); List getSubscribedTags(User user); - - NotifyOpts getNotifyOptions(User user); - - boolean setNotifyOptions(User user, NotifyOpts options); } 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 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; - } } diff --git a/src/main/java/com/juick/service/TagServiceImpl.java b/src/main/java/com/juick/service/TagServiceImpl.java index e7852bc2..1f77eb81 100644 --- a/src/main/java/com/juick/service/TagServiceImpl.java +++ b/src/main/java/com/juick/service/TagServiceImpl.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 @@ -31,7 +31,6 @@ import org.springframework.jdbc.support.KeyHolder; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; -import javax.annotation.Nonnull; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; @@ -130,7 +129,7 @@ public class TagServiceImpl extends BaseJdbcService implements TagService { : holder.getKey().intValue(); } - private class TagStatsMapper implements RowMapper { + private static class TagStatsMapper implements RowMapper { @Override public TagStats mapRow(ResultSet rs, int rowNum) throws SQLException { @@ -215,7 +214,7 @@ public class TagServiceImpl extends BaseJdbcService implements TagService { getJdbcTemplate().batchUpdate("INSERT INTO messages_tags(message_id,tag_id) VALUES (?,?)", new BatchPreparedStatementSetter() { @Override - public void setValues(@Nonnull PreparedStatement ps, int i) throws SQLException { + public void setValues(PreparedStatement ps, int i) throws SQLException { ps.setInt(1, mid); ps.setInt(2, addedTags.get(i).TID); } diff --git a/src/main/java/com/juick/service/TelegramServiceImpl.java b/src/main/java/com/juick/service/TelegramServiceImpl.java index 7b893b6b..3cd6c27d 100644 --- a/src/main/java/com/juick/service/TelegramServiceImpl.java +++ b/src/main/java/com/juick/service/TelegramServiceImpl.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 @@ -25,7 +25,6 @@ import org.springframework.transaction.annotation.Transactional; import java.util.Collections; import java.util.List; import java.util.UUID; -import java.util.stream.Collectors; /** * Created by vt on 24/11/2016. diff --git a/src/main/java/com/juick/service/UserService.java b/src/main/java/com/juick/service/UserService.java index ab060d5f..eeabf42e 100644 --- a/src/main/java/com/juick/service/UserService.java +++ b/src/main/java/com/juick/service/UserService.java @@ -24,11 +24,11 @@ import com.juick.model.AuthResponse; import com.juick.model.ExternalToken; import com.juick.util.UsernameTakenException; +import jakarta.annotation.Nonnull; import org.apache.commons.lang3.tuple.Pair; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; -import javax.annotation.Nonnull; import java.util.Collection; import java.util.List; import java.util.Optional; @@ -42,8 +42,6 @@ public interface UserService { Active } - String getSignUpHashByJID(String jid); - String getSignUpHashByTelegramID(Long telegramId, String username); @CacheEvict(value = { "usernames", "users_by_name" }, allEntries = true) @@ -79,16 +77,10 @@ public interface UserService { @CacheEvict(value = "users_by_name", allEntries = true) boolean updatePassword(User user, String newPassword); - int getUserOptionInt(int uid, String option, int defaultValue); - - int setUserOptionInt(int uid, String option, int value); - User getUserInfo(User user); boolean updateUserInfo(User info); - boolean getCanMedia(int uid); - boolean isInWL(int uid, int check); boolean isInBL(int uid, int check); @@ -107,8 +99,6 @@ public interface UserService { List getUserFriends(int uid); - Integer getUserRecommendations(User user); - List getUserBLUsers(int uid); boolean linkTwitterAccount(User user, String accessToken, String accessTokenSecret, String screenName); diff --git a/src/main/java/com/juick/service/UserServiceImpl.java b/src/main/java/com/juick/service/UserServiceImpl.java index 6114bf78..99e56229 100644 --- a/src/main/java/com/juick/service/UserServiceImpl.java +++ b/src/main/java/com/juick/service/UserServiceImpl.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 @@ -19,6 +19,7 @@ package com.juick.service; import com.juick.model.*; import com.juick.util.UsernameTakenException; +import jakarta.annotation.Nonnull; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; @@ -30,12 +31,10 @@ import org.springframework.dao.DataIntegrityViolationException; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.RowMapper; import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; -import org.springframework.jdbc.support.GeneratedKeyHolder; -import org.springframework.jdbc.support.KeyHolder; +import org.springframework.jdbc.core.simple.SimpleJdbcInsert; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; -import javax.annotation.Nonnull; import java.net.URI; import java.sql.*; import java.time.Instant; @@ -53,7 +52,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { @Value("${juick.admin_users:}") List adminUsers; - private class UserMapper implements RowMapper { + private static class UserMapper implements RowMapper { @Override public User mapRow(@Nonnull ResultSet rs, int rowNum) throws SQLException { User user = new User(); @@ -71,20 +70,6 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { } } - @Transactional - @Override - public String getSignUpHashByJID(final String jid) { - List list = getJdbcTemplate().queryForList( - "SELECT loginhash FROM jids WHERE jid = ? AND user_id IS NULL", String.class, jid); - - if (list.isEmpty()) { - String hash = UUID.randomUUID().toString(); - getJdbcTemplate().update("INSERT INTO jids(jid, loginhash) VALUES (?, ?)", jid, hash); - return hash; - } - return list.get(0); - } - @Transactional @Override public String getSignUpHashByTelegramID(final Long telegramId, final String username) { @@ -105,40 +90,34 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { @Transactional @Override public Optional createUser(final String username, final String password) throws UsernameTakenException { - KeyHolder holder = new GeneratedKeyHolder(); + var userInsert = new SimpleJdbcInsert(getJdbcTemplate()) + .withTableName("users") + .usingColumns("nick", "passw") + .usingGeneratedKeyColumns("id"); + var params = new MapSqlParameterSource(); + params.addValue("nick", username); + params.addValue("passw", password); try { - getJdbcTemplate().update( - con -> { - PreparedStatement stmt = con.prepareStatement( - "INSERT INTO users(nick,passw) VALUES (?,?)", - Statement.RETURN_GENERATED_KEYS); - stmt.setString(1, username); - stmt.setString(2, password); - return stmt; - }, - holder); + var uid = userInsert.executeAndReturnKey(params).intValue(); + if (uid > 0) { + getJdbcTemplate().update("INSERT INTO subscr_users(user_id, suser_id) VALUES (2, ?)", uid); + return getUserByUID(uid); + } } catch (DataIntegrityViolationException e) { throw new UsernameTakenException(); } - - int uid = holder.getKeys().size() > 1 ? ((Number)holder.getKeys().get("id")).intValue() : holder.getKey().intValue(); - - getJdbcTemplate().update("INSERT INTO useroptions(user_id) VALUES (?)", uid); - getJdbcTemplate().update("INSERT INTO subscr_users(user_id, suser_id) VALUES (2, ?)", uid); - - return getUserByUID(uid); + return Optional.empty(); } @Transactional(readOnly = true) @Override public Optional getUserByUID(final int uid) { - List list = getJdbcTemplate().query( - "SELECT DISTINCT u.id, u.nick, u.passw, u.banned, u.last_seen, " + - "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified " + - "FROM users u LEFT JOIN facebook f ON f.user_id = u.id " + - "LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id " + - "LEFT JOIN emails e ON e.user_id = u.id WHERE u.id = ?", new UserMapper(), uid); - + var list = getJdbcTemplate().query(""" + SELECT DISTINCT u.id, u.nick, u.passw, u.banned, u.last_seen, + COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified + FROM users u LEFT JOIN facebook f ON f.user_id = u.id + LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id + LEFT JOIN emails e ON e.user_id = u.id WHERE u.id = ?""", new UserMapper(), uid); return list.isEmpty() ? Optional.empty() : Optional.of(list.get(0)); } @@ -147,14 +126,13 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { @Override public User getUserByName(final String username) { if (StringUtils.isNotBlank(username)) { - List list = getJdbcTemplate().query( - "SELECT DISTINCT u.id, u.nick, u.passw, u.banned, u.last_seen, " + - "COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified " + - "FROM users u LEFT JOIN facebook f ON f.user_id = u.id " + - "LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id " + - "LEFT JOIN emails e ON e.user_id = u.id " + - "WHERE u.nick = ?", new UserMapper(), username); - + var list = getJdbcTemplate().query(""" + SELECT DISTINCT u.id, u.nick, u.passw, u.banned, u.last_seen, + COALESCE(f.fb_id, vk.vk_id, t.tg_id, e.user_id, 0) AS verified + FROM users u LEFT JOIN facebook f ON f.user_id = u.id + LEFT JOIN vk ON u.id = vk.user_id LEFT JOIN telegram t ON u.id = t.user_id + LEFT JOIN emails e ON e.user_id = u.id + WHERE u.nick = ?""", new UserMapper(), username); if (!list.isEmpty()) return list.get(0); } @@ -269,6 +247,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { } @Transactional(readOnly = true) + @Nonnull @Override public User getUserByHash(final String hash) { if (StringUtils.isNotBlank(hash)) { @@ -337,27 +316,6 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { getJdbcTemplate().update("UPDATE users SET passw = ? WHERE id = ?", newPassword, user.getUid()) > 0; } - @Transactional(readOnly = true) - @Override - public int getUserOptionInt(final int uid, final String option, final int defaultValue) { - if (StringUtils.isBlank(option)) - return defaultValue; - - List list = getJdbcTemplate().queryForList( - "SELECT " + option + " FROM useroptions WHERE user_id = ?", Integer.class, uid); - - return list.isEmpty() ? defaultValue : list.get(0); - } - - @Transactional - @Override - public int setUserOptionInt(final int uid, final String option, final int value) { - if (StringUtils.isBlank(option)) - return 0; - - return getJdbcTemplate().update("UPDATE useroptions SET " + option + "= ? WHERE user_id = ?", value, uid); - } - @Transactional(readOnly = true) @Override public User getUserInfo(final User user) { @@ -399,17 +357,6 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { } } - @Transactional(readOnly = true) - @Override - public boolean getCanMedia(final int uid) { - List list = getJdbcTemplate().queryForList( - "SELECT users.lastphoto - UNIX_TIMESTAMP() FROM users WHERE id = ?", - Integer.class, - uid); - - return !list.isEmpty() && list.get(0) < 3600; - } - @Transactional(readOnly = true) @Override public boolean isInWL(final int uid, final int check) { @@ -442,7 +389,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { @Transactional(readOnly = true) @Override public boolean isReplyToBL(final User user, final Message reply) { - return getNamedParameterJdbcTemplate().queryForObject("WITH RECURSIVE banned(reply_id, user_id) AS (" + + var replies = getNamedParameterJdbcTemplate().queryForList("WITH RECURSIVE banned(reply_id, user_id) AS (" + "SELECT reply_id, user_id FROM replies " + "WHERE replies.message_id = :mid " + "AND EXISTS (SELECT 1 FROM bl_users b WHERE b.user_id = :uid AND b.bl_user_id = replies.user_id) " + @@ -459,7 +406,8 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { new MapSqlParameterSource("uid", user.getUid()) .addValue("mid", reply.getMid()) .addValue("rid", reply.getRid()), - Integer.class) > 0; + Integer.class); + return !replies.isEmpty() && replies.get(0) > 0; } @Transactional(readOnly = true) @@ -544,16 +492,6 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { uid); } - @Transactional(readOnly = true) - @Override - public Integer getUserRecommendations(User user) { - try { - return jdbcTemplate.queryForObject("SELECT COUNT(*) FROM favorites WHERE user_id=?", Integer.class, user.getUid()); - } catch (EmptyResultDataAccessException e) { - return 0; - } - } - @Transactional(readOnly = true) @Override public List getUserBLUsers(final int uid) { @@ -838,11 +776,9 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { @Transactional(readOnly = true) @Override public int getUIDbyVKID(long vkID) { - try { - return getJdbcTemplate().queryForObject("SELECT user_id FROM vk WHERE vk_id=? AND user_id IS NOT NULL", Integer.class, vkID); - } catch (EmptyResultDataAccessException e) { - return 0; - } + var users = getJdbcTemplate().queryForList(""" + SELECT user_id FROM vk WHERE vk_id=? AND user_id IS NOT NULL""", Integer.class, vkID); + return users.isEmpty() ? 0 : users.get(0); } @Transactional @@ -928,7 +864,7 @@ public class UserServiceImpl extends BaseJdbcService implements UserService { public boolean canDeleteTelegramUser(User user) { return getEmails(user).size() > 0 || getFbCrossPostStatus(user.getUid()).isConnected() || getVkTokens(user.getUid()).isPresent(); } - private class TokenMapper implements RowMapper { + private static class TokenMapper implements RowMapper { @Override public ExternalToken mapRow(ResultSet rs, int rowNum) throws SQLException { diff --git a/src/main/java/com/juick/www/controllers/Settings.java b/src/main/java/com/juick/www/controllers/Settings.java index a6d036db..d95b21b7 100644 --- a/src/main/java/com/juick/www/controllers/Settings.java +++ b/src/main/java/com/juick/www/controllers/Settings.java @@ -25,11 +25,9 @@ import java.util.stream.IntStream; import javax.inject.Inject; -import com.juick.model.NotifyOpts; import com.juick.model.User; import com.juick.service.EmailService; import com.juick.service.StorageService; -import com.juick.service.SubscriptionService; import com.juick.service.TagService; import com.juick.service.TelegramService; import com.juick.service.UserService; @@ -57,7 +55,6 @@ import org.springframework.context.ApplicationEventPublisher; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; @@ -75,8 +72,6 @@ public class Settings { @Inject private UserService userService; @Inject - private SubscriptionService subscriptionService; - @Inject private EmailService emailService; @Inject private TelegramService telegramService; @@ -111,7 +106,6 @@ public class Settings { model.addAttribute("fbstatus", userService.getFbCrossPostStatus(visitor.getUid())); model.addAttribute("twitter_name", userService.getTwitterName(visitor.getUid())); model.addAttribute("telegram_name", userService.getTelegramName(visitor.getUid())); - model.addAttribute("notify_options", subscriptionService.getNotifyOptions(visitor)); model.addAttribute("userinfo", userService.getUserInfo(visitor)); if (page.equals("auth-email")) { if (emailService.verifyAddressByCode(visitor.getUid(), code)) { @@ -151,15 +145,6 @@ public class Settings { response.addCookie(c); } break; - case "main": - NotifyOpts opts = new NotifyOpts(); - opts.setRepliesEnabled(StringUtils.isNotEmpty(request.getParameter("jnotify"))); - opts.setSubscriptionsEnabled(StringUtils.isNotEmpty(request.getParameter("subscr_notify"))); - opts.setRecommendationsEnabled(StringUtils.isNotEmpty(request.getParameter("recomm"))); - if (subscriptionService.setNotifyOptions(visitor, opts)) { - result = "

Notification options has been updated

"; - } - break; case "about": visitor.setFullName(request.getParameter("fullname")); visitor.setCountry(request.getParameter("country")); diff --git a/src/main/resources/db/migration/V1.34__drop_useroptions.sql b/src/main/resources/db/migration/V1.34__drop_useroptions.sql new file mode 100644 index 00000000..9162909f --- /dev/null +++ b/src/main/resources/db/migration/V1.34__drop_useroptions.sql @@ -0,0 +1 @@ +DROP TABLE useroptions diff --git a/src/main/resources/templates/views/settings_main.html b/src/main/resources/templates/views/settings_main.html index 8f3873a0..713b0146 100644 --- a/src/main/resources/templates/views/settings_main.html +++ b/src/main/resources/templates/views/settings_main.html @@ -9,18 +9,6 @@ Browser notifications -
-
- Notification options -

Reply notifications ("Message posted")

-

Subscriptions notifications ("@user subscribed...")

-

Posts recommendations ("Recommended by @user")

-

-
-
-- cgit v1.2.3