##// 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 from boards.models import Tag
2 from boards.models import Tag
2 from boards.models.thread import FAV_THREAD_NO_UPDATES
3 from boards.models.thread import FAV_THREAD_NO_UPDATES
3
4
@@ -126,14 +127,17 b' class SettingsManager:'
126
127
127 def add_or_read_fav_thread(self, opening_post):
128 def add_or_read_fav_thread(self, opening_post):
128 threads = self.get_fav_threads()
129 threads = self.get_fav_threads()
129 thread = opening_post.get_thread()
130
130 # Don't check for new posts if the thread is archived already
131 max_fav_threads = settings.get_int('View', 'MaxFavoriteThreads')
131 if thread.is_archived():
132 if (str(opening_post.id) in threads) or (len(threads) < max_fav_threads):
132 last_id = FAV_THREAD_NO_UPDATES
133 thread = opening_post.get_thread()
133 else:
134 # Don't check for new posts if the thread is archived already
134 last_id = thread.get_replies().last().id
135 if thread.is_archived():
135 threads[str(opening_post.id)] = last_id
136 last_id = FAV_THREAD_NO_UPDATES
136 self.set_setting(SETTING_FAVORITE_THREADS, threads)
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 def del_fav_thread(self, opening_post):
142 def del_fav_thread(self, opening_post):
139 threads = self.get_fav_threads()
143 threads = self.get_fav_threads()
@@ -28,6 +28,7 b' DefaultImageViewer = simple'
28 LastRepliesCount = 3
28 LastRepliesCount = 3
29 ThreadsPerPage = 3
29 ThreadsPerPage = 3
30 ImagesPerPageGallery = 20
30 ImagesPerPageGallery = 20
31 MaxFavoriteThreads = 20
31
32
32 [Storage]
33 [Storage]
33 # Enable archiving threads instead of deletion when the thread limit is reached
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