diff --git a/boards/abstracts/settingsmanager.py b/boards/abstracts/settingsmanager.py --- a/boards/abstracts/settingsmanager.py +++ b/boards/abstracts/settingsmanager.py @@ -1,3 +1,4 @@ +from boards import settings from boards.models import Tag from boards.models.thread import FAV_THREAD_NO_UPDATES @@ -126,14 +127,17 @@ class SettingsManager: def add_or_read_fav_thread(self, opening_post): threads = self.get_fav_threads() - thread = opening_post.get_thread() - # Don't check for new posts if the thread is archived already - if thread.is_archived(): - last_id = FAV_THREAD_NO_UPDATES - else: - last_id = thread.get_replies().last().id - threads[str(opening_post.id)] = last_id - self.set_setting(SETTING_FAVORITE_THREADS, threads) + + max_fav_threads = settings.get_int('View', 'MaxFavoriteThreads') + if (str(opening_post.id) in threads) or (len(threads) < max_fav_threads): + thread = opening_post.get_thread() + # Don't check for new posts if the thread is archived already + if thread.is_archived(): + last_id = FAV_THREAD_NO_UPDATES + else: + last_id = thread.get_replies().last().id + threads[str(opening_post.id)] = last_id + self.set_setting(SETTING_FAVORITE_THREADS, threads) def del_fav_thread(self, opening_post): threads = self.get_fav_threads() diff --git a/boards/config/default_settings.ini b/boards/config/default_settings.ini --- a/boards/config/default_settings.ini +++ b/boards/config/default_settings.ini @@ -28,6 +28,7 @@ DefaultImageViewer = simple LastRepliesCount = 3 ThreadsPerPage = 3 ImagesPerPageGallery = 20 +MaxFavoriteThreads = 20 [Storage] # Enable archiving threads instead of deletion when the thread limit is reached