mirror of
https://github.com/modoboa/modoboa.git
synced 2026-04-25 08:56:02 +03:00
[PR #6] [CLOSED] Feature: spam score and sorting in quarantine. #1950
Labels
No labels
bug
bug
dependencies
design
documentation
duplicate
enhancement
enhancement
enhancement
feedback-needed
help-needed
help-needed
installer
invalid
looking-for-sponsors
modoboa-contacts
new-ui
new-ui
pr
pull-request
pyconfr
python
question
security
stale
webmail
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/modoboa-modoboa#1950
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/modoboa/modoboa/pull/6
Author: @lddubeau
Created: 8/10/2013
Status: ❌ Closed
Base:
master← Head:feature/score-and-sorting-in-quarantine📝 Commits (6)
5046cf0If a limit is specified, we have to make sure the value is a string before trying to limit it, otherwise the code fails if the value is not a string (e.g. an integer).4fb5acejquery.sortable.js is now needed by quarantine.js18bcd23Added everything needed to get the spam score out of the database and be able to sort on it (or any other data presented to the user).7938a74Added support for sorting the table that is shown to the user.66fd8e0Specify a default order in the default URL.9d7b0b2Perform the sorting at the SQL level instead of Python.📊 Changes
5 files changed (+86 additions, -37 deletions)
View changed files
📝
modoboa/extensions/amavis/sql_listing.py(+46 -33)📝
modoboa/extensions/amavis/static/amavis/js/quarantine.js(+33 -1)📝
modoboa/extensions/amavis/templates/amavis/index.html(+1 -0)📝
modoboa/extensions/amavis/views.py(+1 -1)📝
modoboa/lib/tables.py(+5 -2)📄 Description
This patch adds two things:
Regarding the changes to SQLconnector:
In the old implementation, the unit of measure by which
fetch()determined its start and end was different from the unit of measure returned bymessages_count(). For normal user, I believe the query used would make it so that the two units would correspond, but for an administrator looking at the entire quarantine it is possible for one item in what wasself.messageswould have aqm.mail.msgrcpt_setcontaining more than one item. I believe this would happen if the same spam item was sent to more than one user on the system being managed. (For instance, if the admin has set the default to 40 messages per page and it happens that in one page one message was sent to 10 users, I believe that for that page, the admin would see 9 messages over the 40 message preference.)In the new implementation, the number returned by
messages_count()is exactly the number of items thatfetch()can return.In the old implementation calling
fetch()beforemessages_count()would have resulted in a crash. That's still true.Although it would be possible to write a SQL query to get the data out of the database already sorted, I believe this would require bypassing Django's models (either that, or my Django-fu is lacking). I've opted to retrieve the entire data from the database in one shot and do a Python sort. I realize this may be a problem for large datasets.
ETA: This was developed against 1.0.0 because that's what I have installed on my system and I don't see myself upgrading to experimental code just for this modification.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.