##// END OF EJS Templates
Limit favorite threads count
neko259 -
r1626:a034f64b default
parent child Browse files
Show More
@@ -1,3 +1,4 b''
1 from boards import settings
1 2 from boards.models import Tag
2 3 from boards.models.thread import FAV_THREAD_NO_UPDATES
3 4
@@ -126,14 +127,17 b' class SettingsManager:'
126 127
127 128 def add_or_read_fav_thread(self, opening_post):
128 129 threads = self.get_fav_threads()
129 thread = opening_post.get_thread()
130 # Don't check for new posts if the thread is archived already
131 if thread.is_archived():
132 last_id = FAV_THREAD_NO_UPDATES
133 else:
134 last_id = thread.get_replies().last().id
135 threads[str(opening_post.id)] = last_id
136 self.set_setting(SETTING_FAVORITE_THREADS, threads)
130
131 max_fav_threads = settings.get_int('View', 'MaxFavoriteThreads')
132 if (str(opening_post.id) in threads) or (len(threads) < max_fav_threads):
133 thread = opening_post.get_thread()
134 # Don't check for new posts if the thread is archived already
135 if thread.is_archived():
136 last_id = FAV_THREAD_NO_UPDATES
137 else:
138 last_id = thread.get_replies().last().id
139 threads[str(opening_post.id)] = last_id
140 self.set_setting(SETTING_FAVORITE_THREADS, threads)
137 141
138 142 def del_fav_thread(self, opening_post):
139 143 threads = self.get_fav_threads()
@@ -28,6 +28,7 b' DefaultImageViewer = simple'
28 28 LastRepliesCount = 3
29 29 ThreadsPerPage = 3
30 30 ImagesPerPageGallery = 20
31 MaxFavoriteThreads = 20
31 32
32 33 [Storage]
33 34 # Enable archiving threads instead of deletion when the thread limit is reached
General Comments 0
You need to be logged in to leave comments. Login now