X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/62604660ed4357d8e2cb3e920751c3a7be8d4234..554564294a9a644a3a6723c386f5eb009e23ce98:/forum/views/users.py diff --git a/forum/views/users.py b/forum/views/users.py index 1d12b4e..8766851 100644 --- a/forum/views/users.py +++ b/forum/views/users.py @@ -11,11 +11,12 @@ from forum.http_responses import HttpResponseUnauthorized from django.utils.translation import ugettext as _ from django.utils.http import urlquote_plus from django.utils.html import strip_tags +from django.utils.encoding import smart_unicode from django.utils import simplejson from django.core.urlresolvers import reverse, NoReverseMatch from forum.forms import * from forum.utils.html import sanitize_html -from forum.modules import decorate +from forum.modules import decorate, ReturnImediatelyException from datetime import datetime, date from forum.actions import EditProfileAction, FavoriteAction, BonusRepAction, SuspendAction from forum.modules import ui @@ -70,7 +71,7 @@ def users(request): }) -@decorators.render('users/online_users.html', 'online_users', _('Online Users'), weight=200) +@decorators.render('users/online_users.html', 'online_users', _('Online Users'), weight=200, tabbed=False) def online_users(request): suser = request.REQUEST.get('q', "") @@ -259,17 +260,17 @@ def user_view(template, tab_name, tab_title, tab_description, private=False, tab def params(request, id, slug=None): user = get_object_or_404(User, id=id) if private and not (user == request.user or request.user.is_superuser): - return HttpResponseUnauthorized(request) + raise ReturnImediatelyException(HttpResponseUnauthorized(request)) if render_to and (not render_to(user)): - return HttpResponseRedirect(user.get_profile_url()) + raise ReturnImediatelyException(HttpResponseRedirect(user.get_profile_url())) return [request, user], {} decorated = decorate.params.withfn(params)(fn) def result(context, request, user): - rev_page_title = user.username + " - " + tab_description + rev_page_title = smart_unicode(user.username) + " - " + tab_description context.update({ "tab": "users", @@ -338,7 +339,7 @@ def user_recent(request, user): return {"view_user" : user, "activities" : activities} -@user_view('users/reputation.html', 'reputation', _('karma history'), _('graph of user karma')) +@user_view('users/reputation.html', 'reputation', _('reputation history'), _('graph of user karma')) def user_reputation(request, user): rep = list(user.reputes.order_by('date')) values = [r.value for r in rep] @@ -368,7 +369,7 @@ def user_favorites(request, user): @user_view('users/subscriptions.html', 'subscriptions', _('subscription'), _('subscriptions'), True, tabbed=False) def user_subscriptions(request, user): - enabled = user.subscription_settings.enable_notifications + enabled = True tab = request.GET.get('tab', "settings") @@ -382,14 +383,6 @@ def user_subscriptions(request, user): form.save() message = _('New subscription settings are now saved') - if 'notswitch' in request.POST: - enabled = not enabled - - if enabled: - message = _('Notifications are now enabled') - else: - message = _('Notifications are now disabled') - user.subscription_settings.enable_notifications = enabled user.subscription_settings.save()