mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-17 04:20:57 +08:00
Compare commits
10 Commits
codex/fix-
...
pr-971
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6baa4d4233 | ||
|
|
ef9d90455f | ||
|
|
5d499956d7 | ||
|
|
9101ed336c | ||
|
|
e93e33fe43 | ||
|
|
0ebeccf21e | ||
|
|
89842b82e9 | ||
|
|
58594229f2 | ||
|
|
b4a811ff4e | ||
|
|
7067630bcc |
@@ -97,8 +97,10 @@ public class CachingConfig {
|
||||
// 个别缓存单独设置 TTL 时间
|
||||
Map<String, RedisCacheConfiguration> cacheConfigs = new HashMap<>();
|
||||
RedisCacheConfiguration oneHourConfig = config.entryTtl(Duration.ofHours(1));
|
||||
RedisCacheConfiguration tenMinutesConfig = config.entryTtl(Duration.ofMinutes(10));
|
||||
cacheConfigs.put(TAG_CACHE_NAME, oneHourConfig);
|
||||
cacheConfigs.put(CATEGORY_CACHE_NAME, oneHourConfig);
|
||||
cacheConfigs.put(POST_CACHE_NAME, tenMinutesConfig);
|
||||
|
||||
return RedisCacheManager.builder(connectionFactory)
|
||||
.cacheDefaults(config)
|
||||
|
||||
@@ -8,4 +8,6 @@ import java.util.List;
|
||||
|
||||
public interface PostChangeLogRepository extends JpaRepository<PostChangeLog, Long> {
|
||||
List<PostChangeLog> findByPostOrderByCreatedAtAsc(Post post);
|
||||
|
||||
void deleteByPost(Post post);
|
||||
}
|
||||
|
||||
@@ -109,6 +109,10 @@ public class PostChangeLogService {
|
||||
logRepository.save(log);
|
||||
}
|
||||
|
||||
public void deleteLogsForPost(Post post) {
|
||||
logRepository.deleteByPost(post);
|
||||
}
|
||||
|
||||
public List<PostChangeLog> listLogs(Long postId) {
|
||||
Post post = postRepository.findById(postId)
|
||||
.orElseThrow(() -> new com.openisle.exception.NotFoundException("Post not found"));
|
||||
|
||||
@@ -191,7 +191,7 @@ public class PostService {
|
||||
return saved;
|
||||
}
|
||||
@CacheEvict(
|
||||
value = CachingConfig.POST_CACHE_NAME, allEntries = true
|
||||
value = CachingConfig.POST_CACHE_NAME, allEntries = true
|
||||
)
|
||||
public Post createPost(String username,
|
||||
Long categoryId,
|
||||
@@ -888,6 +888,7 @@ public class PostService {
|
||||
}
|
||||
}
|
||||
String title = post.getTitle();
|
||||
postChangeLogService.deleteLogsForPost(post);
|
||||
postRepository.delete(post);
|
||||
if (adminDeleting) {
|
||||
notificationService.createNotification(author, NotificationType.POST_DELETED,
|
||||
|
||||
@@ -100,7 +100,7 @@ public class UserService {
|
||||
* @param user
|
||||
*/
|
||||
public void sendVerifyMail(User user, VerifyType verifyType){
|
||||
//缓存验证码
|
||||
// 缓存验证码
|
||||
String code = genCode();
|
||||
String key;
|
||||
String subject;
|
||||
|
||||
@@ -71,6 +71,7 @@ class PostServiceTest {
|
||||
|
||||
verify(postReadService).deleteByPost(post);
|
||||
verify(postRepo).delete(post);
|
||||
verify(postChangeLogService).deleteLogsForPost(post);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
--primary-color-hover: rgb(9, 95, 105);
|
||||
--primary-color: rgb(10, 110, 120);
|
||||
--primary-color-disabled: rgba(93, 152, 156, 0.5);
|
||||
--secondary-color:rgb(255, 255, 255);
|
||||
--secondary-color-hover:rgba(165, 255, 255, 0.447);
|
||||
--secondary-color: rgb(255, 255, 255);
|
||||
--secondary-color-hover: rgba(10, 111, 120, 0.184);
|
||||
--new-post-icon-color: rgba(10, 111, 120, 0.598);
|
||||
--header-height: 60px;
|
||||
--header-background-color: white;
|
||||
|
||||
@@ -712,13 +712,13 @@ watch(selectedTab, async (val) => {
|
||||
border-radius: 8px;
|
||||
padding: 5px 10px;
|
||||
color: var(--primary-color);
|
||||
background-color: var(--secondary-color);
|
||||
border: 1px solid var(--primary-color);
|
||||
margin-top: 15px;
|
||||
width: fit-content;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.profile-page-header-unsubscribe-button:hover,
|
||||
.profile-page-header-send-mail-button:hover {
|
||||
background-color: var(--secondary-color-hover);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user