You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by ke...@apache.org on 2018/03/08 18:38:13 UTC
allura git commit: [#8193] Include rate limiting on forum topics,
fix minor tickets UI bug
Repository: allura
Updated Branches:
refs/heads/kt/8193 cf6bdb395 -> cd295f4b8
[#8193] Include rate limiting on forum topics, fix minor tickets UI bug
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/cd295f4b
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/cd295f4b
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/cd295f4b
Branch: refs/heads/kt/8193
Commit: cd295f4b8345b588a2b701e9f54baf84d9799690
Parents: cf6bdb3
Author: Kenton Taylor <kt...@slashdotmedia.com>
Authored: Thu Mar 8 13:37:38 2018 -0500
Committer: Kenton Taylor <kt...@slashdotmedia.com>
Committed: Thu Mar 8 13:37:38 2018 -0500
----------------------------------------------------------------------
Allura/allura/controllers/discuss.py | 4 ++--
Allura/allura/model/artifact.py | 1 +
Allura/development.ini | 2 ++
ForgeDiscussion/forgediscussion/controllers/root.py | 1 +
ForgeTracker/forgetracker/templates/tracker/ticket.html | 7 ++++---
5 files changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/cd295f4b/Allura/allura/controllers/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py
index ba31409..100ce44 100644
--- a/Allura/allura/controllers/discuss.py
+++ b/Allura/allura/controllers/discuss.py
@@ -209,7 +209,7 @@ class ThreadController(BaseController, FeedController):
@utils.AntiSpam.validate('Spambot protection engaged')
def post(self, **kw):
require_access(self.thread, 'post')
- self.rate_limit(M.Post, "Comment", redir='..')
+ self.rate_limit(M.Post, "Comment", redir=request.referrer)
if self.thread.ref:
require_access(self.thread.ref.artifact, 'post')
kw = self.W.edit_post.to_python(kw, None)
@@ -345,7 +345,7 @@ class PostController(BaseController):
@require_post(redir='.')
def reply(self, file_info=None, **kw):
require_access(self.thread, 'post')
- self.rate_limit(M.Post, "Comment", redir='..')
+ self.rate_limit(M.Post, "Comment", redir=request.referrer)
kw = self.W.edit_post.to_python(kw, None)
p = self.thread.add_post(parent_id=self.post._id, **kw)
p.add_multiple_attachments(file_info)
http://git-wip-us.apache.org/repos/asf/allura/blob/cd295f4b/Allura/allura/model/artifact.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py
index 30836f1..7933e7f 100644
--- a/Allura/allura/model/artifact.py
+++ b/Allura/allura/model/artifact.py
@@ -646,6 +646,7 @@ class VersionedArtifact(Artifact):
if 'user' in kwargs:
def distinct_artifacts_by_user():
# count distinct items, not total (e.g. many edits to a single wiki page doesn't count against you)
+ # query history here, as regular base artifacts have no author information
HC = cls.__mongometa__.history_class
artifacts = HC.query.find({'author.id': kwargs['user']._id}).distinct('artifact_id')
"""
http://git-wip-us.apache.org/repos/asf/allura/blob/cd295f4b/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 81ebe6c..74a1d1d 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -526,10 +526,12 @@ forgemail.domain = .in.localhost
; Number of different wiki pages, tickets, etc that a user can create or edit, per time period, across all projects
; Keys are number of seconds, values are max number allowed until that time period is reached
; NOTE: wiki pages include the default "Home" page created for the user-project and any other projects created by the user
+; NOTE: allura.rate_limits* cover posts to threads across all tools.
;forgewiki.rate_limits_per_user = {"60": 3, "120": 3, "900": 5, "1800": 7, "3600": 10, "7200": 15, "86400": 20, "604800": 50, "2592000": 200}
;forgetracker.rate_limits_per_user = {"60": 1, "120": 3, "900": 5, "1800": 7, "3600": 10, "7200": 15, "86400": 20, "604800": 50, "2592000": 200}
;forgeblog.rate_limits_per_user = {"60": 1, "120": 3, "900": 5, "1800": 7, "3600": 10, "7200": 15, "86400": 20, "604800": 50, "2592000": 200}
;allura.rate_limits_per_user = {"60": 1, "120": 3, "900": 5, "1800": 7, "3600": 10, "7200": 15, "86400": 20, "604800": 50, "2592000": 200}
+;forgediscussion.rate_limits_per_user = {"60": 1, "120": 3, "900": 5, "1800": 7, "3600": 10, "7200": 15, "86400": 20, "604800": 50, "2592000": 200}
; set this to "false" if you are deploying to production and want performance improvements
http://git-wip-us.apache.org/repos/asf/allura/blob/cd295f4b/ForgeDiscussion/forgediscussion/controllers/root.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/controllers/root.py b/ForgeDiscussion/forgediscussion/controllers/root.py
index 4b35254..176156f 100644
--- a/ForgeDiscussion/forgediscussion/controllers/root.py
+++ b/ForgeDiscussion/forgediscussion/controllers/root.py
@@ -123,6 +123,7 @@ class RootController(BaseController, DispatchIndex, FeedController):
@validate(W.new_topic, error_handler=create_topic)
@AntiSpam.validate('Spambot protection engaged')
def save_new_topic(self, subject=None, text=None, forum=None, **kw):
+ self.rate_limit(model.ForumPost, 'Topic creation', request.referer)
discussion = model.Forum.query.get(
app_config_id=c.app.config._id,
shortname=forum)
http://git-wip-us.apache.org/repos/asf/allura/blob/cd295f4b/ForgeTracker/forgetracker/templates/tracker/ticket.html
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/templates/tracker/ticket.html b/ForgeTracker/forgetracker/templates/tracker/ticket.html
index 8665611..2895829 100644
--- a/ForgeTracker/forgetracker/templates/tracker/ticket.html
+++ b/ForgeTracker/forgetracker/templates/tracker/ticket.html
@@ -189,7 +189,7 @@
var discussion_holder = $('#discussion_holder');
var ticket_content = $('#ticket_content');
var title_holder = $('h2.dark');
- var original_title = title_holder.text();
+ var original_title = title_holder.html();
var title_actions = title_holder.find('small');
var vote = $('#vote');
@@ -218,7 +218,8 @@
$(this).trigger('editTicket');
return false;
});
- if ($('div > div.error').hasClass('error')){
+ var flashErrors = $('div > div.error');
+ if (flashErrors.hasClass('error') && flashErrors.html().indexOf('rate limit') < 0){
$('a.edit_ticket').click();
}
$('a.cancel_form').click(function () {
@@ -226,7 +227,7 @@
view_holder.show();
discussion_holder.show();
ticket_content.show();
- title_holder.text(original_title);
+ title_holder.html(original_title);
title_actions.appendTo(title_holder);
title_actions.show();
vote.show();