summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdolfo Fitoria <adolfo.fitoria@gmail.com>2013-01-03 14:56:20 -0600
committerAdolfo Fitoria <adolfo.fitoria@gmail.com>2013-01-03 14:56:20 -0600
commit2b3df40cf5867b6e98c5ee4403e046b138f83b34 (patch)
tree2b619bd8b2a7bf234895ffcfbf2c22f7735bcc94
parent10efba5b7f3dd3d1cbe332bd1d0f8bfd4a2ad7ef (diff)
downloadaskbot-2b3df40cf5867b6e98c5ee4403e046b138f83b34.tar.gz
askbot-2b3df40cf5867b6e98c5ee4403e046b138f83b34.tar.bz2
askbot-2b3df40cf5867b6e98c5ee4403e046b138f83b34.zip
allowing admins to add tag subscription in the user profile
-rw-r--r--askbot/media/js/tag_selector.js3
-rw-r--r--askbot/views/commands.py17
2 files changed, 13 insertions, 7 deletions
diff --git a/askbot/media/js/tag_selector.js b/askbot/media/js/tag_selector.js
index fd637848..3b916d40 100644
--- a/askbot/media/js/tag_selector.js
+++ b/askbot/media/js/tag_selector.js
@@ -123,7 +123,8 @@ function pickedTags(){
var data = JSON.stringify({
tagnames: tagnames,
- reason: reason
+ reason: reason,
+ user: askbot['data']['viewUserId']
});
var call_settings = {
type:'POST',
diff --git a/askbot/views/commands.py b/askbot/views/commands.py
index 1663a049..375b2202 100644
--- a/askbot/views/commands.py
+++ b/askbot/views/commands.py
@@ -437,13 +437,18 @@ def mark_tag(request, **kwargs):#tagging system
reason = post_data['reason']
assert reason in ('good', 'bad', 'subscribed')
#separate plain tag names and wildcard tags
-
tagnames, wildcards = forms.clean_marked_tagnames(raw_tagnames)
- cleaned_tagnames, cleaned_wildcards = request.user.mark_tags(
- tagnames,
- wildcards,
- reason = reason,
- action = action
+
+ if request.user.is_administrator() and post_data['user'] != request.user.id:
+ user = get_object_or_404(models.User, pk=post_data['user'])
+ else:
+ user = request.user
+
+ cleaned_tagnames, cleaned_wildcards = user.mark_tags(
+ tagnames,
+ wildcards,
+ reason = reason,
+ action = action
)
#lastly - calculate tag usage counts