From bcdc986552c66639606ed5e7e9956822b5136801 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Thu, 6 Oct 2011 17:27:41 -0300 Subject: moved mention savings to the celery job and now many test cases for email alerts fail --- askbot/models/base.py | 10 ---------- askbot/tasks.py | 16 +++++++++++++++- askbot/tests/on_screen_notification_tests.py | 2 ++ 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/askbot/models/base.py b/askbot/models/base.py index 80572b86..b456bca8 100644 --- a/askbot/models/base.py +++ b/askbot/models/base.py @@ -134,16 +134,6 @@ def parse_and_save_post(post, author = None, **kwargs): timestamp = post.get_time_of_last_edit() - #create new mentions - for u in newly_mentioned_users: - from askbot.models.user import Activity - Activity.objects.create_new_mention( - mentioned_whom = u, - mentioned_in = post, - mentioned_by = author, - mentioned_at = timestamp - ) - #todo: this is handled in signal because models for posts #are too spread out from askbot.models import signals diff --git a/askbot/tasks.py b/askbot/tasks.py index b0ac5356..0a238df1 100644 --- a/askbot/tasks.py +++ b/askbot/tasks.py @@ -100,7 +100,21 @@ def record_post_update( exclude_list = [updated_by, ] ) - update_activity.add_recipients(recipients) + #create new mentions + for u in newly_mentioned_users: + from askbot.models.user import Activity + Activity.objects.create_new_mention( + mentioned_whom = u, + mentioned_in = post, + mentioned_by = updated_by, + mentioned_at = timestamp + ) + + #we don't want to save a mention and a separate notification + #about the response + update_activity.add_recipients( + recipients# - set(newly_mentioned_users) + ) assert(updated_by not in recipients) diff --git a/askbot/tests/on_screen_notification_tests.py b/askbot/tests/on_screen_notification_tests.py index 574f4e5e..0d668542 100644 --- a/askbot/tests/on_screen_notification_tests.py +++ b/askbot/tests/on_screen_notification_tests.py @@ -244,6 +244,8 @@ class OnScreenUpdateNotificationTests(TestCase): ) def test_self_comments(self): + """poster of the question or answer adds a comment + under the corresponding question or answer""" self.reset_response_counts() time.sleep(1) timestamp = datetime.datetime.now() -- cgit v1.2.3-1-g7c22 From d6d0f6ff6458e80ad5de0e4e21f2d01ca8ad978e Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Fri, 7 Oct 2011 12:17:30 -0300 Subject: fixed the duplicate menttion&response in the inbox bug102 --- askbot/tasks.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/askbot/tasks.py b/askbot/tasks.py index 0a238df1..465465ef 100644 --- a/askbot/tasks.py +++ b/askbot/tasks.py @@ -41,7 +41,6 @@ def record_post_update_celery_task( id__in = newly_mentioned_user_id_list ) - record_post_update( post = post, updated_by = updated_by, @@ -71,7 +70,6 @@ def record_post_update( * records "red envelope" recipients of the post * sends email alerts to all subscribers to the post """ - #todo: take into account created == True case (activity_type, update_object) = post.get_updated_activity_data(created) @@ -99,10 +97,16 @@ def record_post_update( recipients = post.get_response_receivers( exclude_list = [updated_by, ] ) + update_activity.add_recipients(recipients) #create new mentions for u in newly_mentioned_users: - from askbot.models.user import Activity + #todo: a hack - some users will not have record of a mention + #may need to fix this in the future. Added this so that + #recipients of the response who are mentioned as well would + #not get two notifications in the inbox for the same post + if u in recipients: + continue Activity.objects.create_new_mention( mentioned_whom = u, mentioned_in = post, @@ -110,12 +114,6 @@ def record_post_update( mentioned_at = timestamp ) - #we don't want to save a mention and a separate notification - #about the response - update_activity.add_recipients( - recipients# - set(newly_mentioned_users) - ) - assert(updated_by not in recipients) for user in (set(recipients) | set(newly_mentioned_users)): -- cgit v1.2.3-1-g7c22 From 24ff4a184a200b9e2620189db04d38a218194656 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Fri, 7 Oct 2011 14:24:08 -0300 Subject: moved "exclude db" statement in the MANIFEST.in up, so that the empty db file is not included into the distribution --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 7d503fb7..c6e22075 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -11,6 +11,7 @@ recursive-exclude .git prune dist prune tmp prune build +exclude db exclude lint exclude settings.py exclude manage.py @@ -26,4 +27,3 @@ recursive-exclude categories * recursive-exclude follow * recursive-exclude env * recursive-exclude .tox -exclude db -- cgit v1.2.3-1-g7c22 From 1f2e3b559fa5d56932f8da46b6a734954cdbd6db Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Fri, 7 Oct 2011 14:26:13 -0300 Subject: fixed tag rendering bug in opera --- .../default/media/js/jquery.animate-colors.js | 105 +++++++++++++++++++++ askbot/skins/default/media/style/style.css | 1 - 2 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 askbot/skins/default/media/js/jquery.animate-colors.js diff --git a/askbot/skins/default/media/js/jquery.animate-colors.js b/askbot/skins/default/media/js/jquery.animate-colors.js new file mode 100644 index 00000000..07d8ac9c --- /dev/null +++ b/askbot/skins/default/media/js/jquery.animate-colors.js @@ -0,0 +1,105 @@ +/**! + * @preserve Color animation jQuery-plugin + * http://www.bitstorm.org/jquery/color-animation/ + * Copyright 2011 Edwin Martin + * Released under the MIT and GPL licenses. + */ + +(function($) { + /** + * Check whether the browser supports RGBA color mode. + * + * Author Mehdi Kabab + * @return {boolean} True if the browser support RGBA. False otherwise. + */ + function isRGBACapable() { + var $script = $('script:first'), + color = $script.css('color'), + result = false; + if (/^rgba/.test(color)) { + result = true; + } else { + try { + result = ( color != $script.css('color', 'rgba(0, 0, 0, 0.5)').css('color') ); + $script.css('color', color); + } catch (e) { + } + } + + return result; + } + + $.extend(true, $, { + support: { + 'rgba': isRGBACapable() + } + }); + + var properties = ['color', 'backgroundColor', 'borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor', 'outlineColor']; + $.each(properties, function(i, property) { + $.fx.step[property] = function(fx) { + if (!fx.init) { + fx.begin = parseColor($(fx.elem).css(property)); + fx.end = parseColor(fx.end); + fx.init = true; + } + + fx.elem.style[property] = calculateColor(fx.begin, fx.end, fx.pos); + } + }); + + // borderColor doesn't fit in standard fx.step above. + $.fx.step.borderColor = function(fx) { + if (!fx.init) { + fx.end = parseColor(fx.end); + } + var borders = properties.slice(2, 6); // All four border properties + $.each(borders, function(i, property) { + if (!fx.init) { + fx[property] = {begin: parseColor($(fx.elem).css(property))}; + } + + fx.elem.style[property] = calculateColor(fx[property].begin, fx.end, fx.pos); + }); + fx.init = true; + } + + // Calculate an in-between color. Returns "#aabbcc"-like string. + function calculateColor(begin, end, pos) { + var color = 'rgb' + ($.support['rgba'] ? 'a' : '') + '(' + + parseInt((begin[0] + pos * (end[0] - begin[0])), 10) + ',' + + parseInt((begin[1] + pos * (end[1] - begin[1])), 10) + ',' + + parseInt((begin[2] + pos * (end[2] - begin[2])), 10); + if ($.support['rgba']) { + color += ',' + (begin && end ? parseFloat(begin[3] + pos * (end[3] - begin[3])) : 1); + } + color += ')'; + return color; + } + + // Parse an CSS-syntax color. Outputs an array [r, g, b] + function parseColor(color) { + var match, triplet; + + // Match #aabbcc + if (match = /#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})/.exec(color)) { + triplet = [parseInt(match[1], 16), parseInt(match[2], 16), parseInt(match[3], 16), 1]; + + // Match #abc + } else if (match = /#([0-9a-fA-F])([0-9a-fA-F])([0-9a-fA-F])/.exec(color)) { + triplet = [parseInt(match[1], 16) * 17, parseInt(match[2], 16) * 17, parseInt(match[3], 16) * 17, 1]; + + // Match rgb(n, n, n) + } else if (match = /rgb\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*\)/.exec(color)) { + triplet = [parseInt(match[1]), parseInt(match[2]), parseInt(match[3]), 1]; + + } else if (match = /rgba\(\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9]{1,3})\s*,\s*([0-9\.]*)\s*\)/.exec(color)) { + triplet = [parseInt(match[1], 10), parseInt(match[2], 10), parseInt(match[3], 10),parseFloat(match[4])]; + + // No browser returns rgb(n%, n%, n%), so little reason to support this format. + } else if (color == 'transparent'){ + triplet = [0,0,0,0] + } + return triplet; + } +})(jQuery); diff --git a/askbot/skins/default/media/style/style.css b/askbot/skins/default/media/style/style.css index 6297721b..600cd31e 100644 --- a/askbot/skins/default/media/style/style.css +++ b/askbot/skins/default/media/style/style.css @@ -473,7 +473,6 @@ ul#related-tags li { float: left; height: 18px; margin: 0 5px 0 0; - overflow-x: hidden; padding: 0; } -- cgit v1.2.3-1-g7c22