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 @@ -11,7 +11,7 @@ CacheTimeout = 600 MaxTextLength = 30000 MaxFileSize = 8000000 LimitFirstPosting = true -LimitPostingSpeed = true +LimitPostingSpeed = false PowDifficulty = 0 # Delay in seconds PostingDelay = 30 diff --git a/boards/forms.py b/boards/forms.py --- a/boards/forms.py +++ b/boards/forms.py @@ -177,6 +177,7 @@ class PostForm(NeboardForm): threads = forms.CharField(required=False, label=_('Additional threads'), widget=forms.TextInput(attrs={ATTRIBUTE_PLACEHOLDER: '123 456 789'})) + subscribe = forms.BooleanField(required=False, label=_('Subscribe to thread')) guess = forms.CharField(widget=forms.HiddenInput(), required=False) timestamp = forms.CharField(widget=forms.HiddenInput(), required=False) @@ -328,6 +329,9 @@ class PostForm(NeboardForm): else: return [] + def is_subscribe(self): + return self.cleaned_data['subscribe'] + def _clean_text_file(self): text = self.cleaned_data.get('text') file = self.get_file() diff --git a/boards/locale/ru/LC_MESSAGES/django.mo b/boards/locale/ru/LC_MESSAGES/django.mo index 3e2810a7292e37580f8fd16420e29973d4521cad..260475828d23dc5902e931395cfa1cd6a6c0412b GIT binary patch literal 10341 zc$~#pZ*UdYb-#(-CMJN8umc#dF5-Xidr06E`+;l(2qRlUL=wbylHx^gkrv+DecpXf zAeW?IYQQ6csAD%CC$WR=ByE#=9s(hdghGyioX?+5dFEA=D8_W@`P=wE}b0{uDYGSCGJgm3)<+2;|^hd_6l z_rnWB&*Qi)1RY!;c3l8{koH|5{(s+$|Ct&8z^wnL1>%?gSRngSSb6R0sScG@ItZU)rBJWtA_tw(0ry;vjr{ceru_ePEQ{T(y^-5T*v5i}s2)reoVE)w|% z7KyxP4DDScIB`K2(>{wtuh$nDyFl+DyB3Mu_ZP`Nw-*Use`wzS6LcNnzgGORsaEXR z2D%iqxmNT&WX7Mb6@MSCHTVJDNpY+dKmUc{|EpTj@29o0-@k&UK%44Bzf7IjAJhr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%Nt%`wXMGAA z3+afYNNagjT>QtR337pvT;uyy?yl#lpr~qJGLaUM~OJk#uBznRSOdGlY@jXwea diff --git a/boards/locale/ru/LC_MESSAGES/django.po b/boards/locale/ru/LC_MESSAGES/django.po --- a/boards/locale/ru/LC_MESSAGES/django.po +++ b/boards/locale/ru/LC_MESSAGES/django.po @@ -551,3 +551,6 @@ msgstr "Удалить тему" msgid "Messages per day/week/month:" msgstr "Сообщений за день/неделю/месяц:" + +msgid "Subscribe to thread" +msgstr "Подписаться на тему" \ No newline at end of file diff --git a/boards/static/js/thread_update.js b/boards/static/js/thread_update.js --- a/boards/static/js/thread_update.js +++ b/boards/static/js/thread_update.js @@ -23,7 +23,7 @@ for the JavaScript code in this page. */ -var CLASS_POST = '.post' +var CLASS_POST = '.post'; var POST_ADDED = 0; var POST_UPDATED = 1; @@ -152,6 +152,16 @@ function getThreadDiff() { // TODO Process removed posts if any $('.metapanel').attr('data-last-update', data.last_update); + + if (data.subscribed == 'True') { + var favButton = $('.not_fav'); + + if (favButton.length > 0) { + favButton.attr('value', 'unsubscribe'); + favButton.removeClass('not_fav'); + favButton.addClass('fav'); + } + } }, 'json' ) diff --git a/boards/views/all_threads.py b/boards/views/all_threads.py --- a/boards/views/all_threads.py +++ b/boards/views/all_threads.py @@ -153,6 +153,10 @@ class AllThreadsView(PostMixin, FileUplo # when creating this one post.notify_clients() + if form.is_subscribe(): + settings_manager = get_settings_manager(request) + settings_manager.add_or_read_fav_thread(post) + if html_response: return redirect(post.get_absolute_url()) diff --git a/boards/views/api.py b/boards/views/api.py --- a/boards/views/api.py +++ b/boards/views/api.py @@ -27,6 +27,7 @@ PARAMETER_UPDATED = 'updated' PARAMETER_LAST_UPDATE = 'last_update' PARAMETER_THREAD = 'thread' PARAMETER_UIDS = 'uids' +PARAMETER_SUBSCRIBED = 'subscribed' DIFF_TYPE_HTML = 'html' DIFF_TYPE_JSON = 'json' @@ -67,6 +68,9 @@ def api_get_threaddiff(request): format_type=diff_type, request=request)) json_data[PARAMETER_LAST_UPDATE] = str(thread.last_edit_time) + settings_manager = get_settings_manager(request) + json_data[PARAMETER_SUBSCRIBED] = str(settings_manager.thread_is_fav(opening_post)) + # If the tag is favorite, update the counter settings_manager = get_settings_manager(request) favorite = settings_manager.thread_is_fav(opening_post) diff --git a/boards/views/thread/thread.py b/boards/views/thread/thread.py --- a/boards/views/thread/thread.py +++ b/boards/views/thread/thread.py @@ -142,6 +142,11 @@ class ThreadView(BaseBoardView, PostMixi images=images) post.notify_clients() + if form.is_subscribe(): + settings_manager = get_settings_manager(request) + settings_manager.add_or_read_fav_thread( + post_thread.get_opening_post()) + if html_response: if opening_post: return redirect(post.get_absolute_url())