[PR #8] [MERGED] Feature: score and sorting in quarantine #1949

Closed
opened 2026-02-27 11:20:18 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/modoboa/modoboa/pull/8
Author: @lddubeau
Created: 9/7/2013
Status: Merged
Merged: 12/3/2013
Merged by: @tonioo

Base: masterHead: feature/score-and-sorting-in-quarantine


📝 Commits (10+)

  • 730af22 If 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).
  • 1a88976 jquery.sortable.js is now needed by quarantine.js
  • 89da4b0 Added 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).
  • 18fdda8 Added support for sorting the table that is shown to the user.
  • 0b5b62d Specify a default order in the default URL.
  • 726e2ac Perform the sorting at the SQL level instead of Python.
  • 141ad9d Reimplemented Quarantine on the basis of Listing.
  • b5c6e90 Merge branch 'master' into feature/score-and-sorting-in-quarantine
  • 5980925 wip: sort spam messages by score.
  • 5dd3a4c wip: sort spam messages by score.

📊 Changes

25 files changed (+623 additions, -337 deletions)

View changed files

📝 modoboa/extensions/admin/models/alias.py (+7 -3)
📝 modoboa/extensions/admin/models/mailbox.py (+11 -0)
📝 modoboa/extensions/amavis/general_callbacks.py (+22 -5)
📝 modoboa/extensions/amavis/lib.py (+34 -0)
📝 modoboa/extensions/amavis/sql_listing.py (+104 -65)
📝 modoboa/extensions/amavis/static/amavis/css/quarantine.css (+22 -1)
📝 modoboa/extensions/amavis/static/amavis/js/quarantine.js (+104 -25)
📝 modoboa/extensions/amavis/templates/amavis/index.html (+5 -2)
modoboa/extensions/amavis/templates/amavis/main_action_bar.html (+38 -0)
📝 modoboa/extensions/amavis/templatetags/amavis_tags.py (+10 -45)
📝 modoboa/extensions/amavis/views.py (+87 -103)
📝 modoboa/extensions/webmail/lib.py (+32 -23)
📝 modoboa/extensions/webmail/static/webmail/css/webmail.css (+11 -0)
📝 modoboa/extensions/webmail/static/webmail/js/webmail.js (+2 -2)
modoboa/extensions/webmail/templates/webmail/main_action_bar.html (+3 -0)
📝 modoboa/extensions/webmail/templatetags/webmail_tags.py (+3 -6)
📝 modoboa/extensions/webmail/views.py (+13 -34)
📝 modoboa/lib/email_listing.py (+0 -13)
📝 modoboa/lib/tables.py (+5 -2)
📝 modoboa/lib/webutils.py (+51 -0)

...and 5 more files

📄 Description

I don't think this is quite ready to pull yet but I don't see a way to get a discussion going about this without putting in a pull request.

I've reimplemented Quarantine on the basis of Listing. There was no inherent obstacle to doing so but the lack of code documentation made the task more difficult than it could have been. I use jsdoc3 for my own needs. Here's an example.

I've rebased my branch on the latest state of master but I've tested it on my own live modoboa installation by diffing the head of the branch against its base and applying this patch onto 1.0.0.

I've not bothered with pep8 because I'd rather focus on functionality rather than cosmetics for now.

I've noticed a problem but I think it is a preexisting architectural problem that my code revealed rather than a problem I've created. If I sort on spam score or date in the quarantine and then navigate to the webmail page, I get a error message that suggests that modoboa is trying to apply the sort I've selected in quarantine to the webmail window. The error is:

UID command error: BAD ['Error in IMAP command UID SORT: Unknown sort argument: SCORE']

It looks like request.session["navparams"] is shared by the two extensions. I'm not sure what the fix is here. Is there anything that should be shared at all between the two?


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/modoboa/modoboa/pull/8 **Author:** [@lddubeau](https://github.com/lddubeau) **Created:** 9/7/2013 **Status:** ✅ Merged **Merged:** 12/3/2013 **Merged by:** [@tonioo](https://github.com/tonioo) **Base:** `master` ← **Head:** `feature/score-and-sorting-in-quarantine` --- ### 📝 Commits (10+) - [`730af22`](https://github.com/modoboa/modoboa/commit/730af22bc40077bf8875facb6909b3e12188cbff) If 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). - [`1a88976`](https://github.com/modoboa/modoboa/commit/1a889761d29f42abd05ebc47c2e279644d97feb0) jquery.sortable.js is now needed by quarantine.js - [`89da4b0`](https://github.com/modoboa/modoboa/commit/89da4b040d43764367b60fbe811524957a3b3984) Added 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). - [`18fdda8`](https://github.com/modoboa/modoboa/commit/18fdda8b888931fcf86021d99857641ef0820dc0) Added support for sorting the table that is shown to the user. - [`0b5b62d`](https://github.com/modoboa/modoboa/commit/0b5b62daf737b3d7ed09085ce5fef89f4aa4c0ec) Specify a default order in the default URL. - [`726e2ac`](https://github.com/modoboa/modoboa/commit/726e2ace554807fe9b4d318ea6c877f5a07df32c) Perform the sorting at the SQL level instead of Python. - [`141ad9d`](https://github.com/modoboa/modoboa/commit/141ad9d7e43f29d31b4620f55a776bf9f80473e2) Reimplemented Quarantine on the basis of Listing. - [`b5c6e90`](https://github.com/modoboa/modoboa/commit/b5c6e906d85adb06183d01881aee3d2b0a92efdd) Merge branch 'master' into feature/score-and-sorting-in-quarantine - [`5980925`](https://github.com/modoboa/modoboa/commit/5980925b34ca26e90b304ce90cf9d4546c77d7fe) wip: sort spam messages by score. - [`5dd3a4c`](https://github.com/modoboa/modoboa/commit/5dd3a4c8bcd0429f91b133bb0f0f22ee54192d04) wip: sort spam messages by score. ### 📊 Changes **25 files changed** (+623 additions, -337 deletions) <details> <summary>View changed files</summary> 📝 `modoboa/extensions/admin/models/alias.py` (+7 -3) 📝 `modoboa/extensions/admin/models/mailbox.py` (+11 -0) 📝 `modoboa/extensions/amavis/general_callbacks.py` (+22 -5) 📝 `modoboa/extensions/amavis/lib.py` (+34 -0) 📝 `modoboa/extensions/amavis/sql_listing.py` (+104 -65) 📝 `modoboa/extensions/amavis/static/amavis/css/quarantine.css` (+22 -1) 📝 `modoboa/extensions/amavis/static/amavis/js/quarantine.js` (+104 -25) 📝 `modoboa/extensions/amavis/templates/amavis/index.html` (+5 -2) ➕ `modoboa/extensions/amavis/templates/amavis/main_action_bar.html` (+38 -0) 📝 `modoboa/extensions/amavis/templatetags/amavis_tags.py` (+10 -45) 📝 `modoboa/extensions/amavis/views.py` (+87 -103) 📝 `modoboa/extensions/webmail/lib.py` (+32 -23) 📝 `modoboa/extensions/webmail/static/webmail/css/webmail.css` (+11 -0) 📝 `modoboa/extensions/webmail/static/webmail/js/webmail.js` (+2 -2) ➕ `modoboa/extensions/webmail/templates/webmail/main_action_bar.html` (+3 -0) 📝 `modoboa/extensions/webmail/templatetags/webmail_tags.py` (+3 -6) 📝 `modoboa/extensions/webmail/views.py` (+13 -34) 📝 `modoboa/lib/email_listing.py` (+0 -13) 📝 `modoboa/lib/tables.py` (+5 -2) 📝 `modoboa/lib/webutils.py` (+51 -0) _...and 5 more files_ </details> ### 📄 Description I don't think this is quite ready to pull yet but I don't see a way to get a discussion going about this without putting in a pull request. I've reimplemented Quarantine on the basis of Listing. There was no inherent obstacle to doing so but the lack of code documentation made the task more difficult than it could have been. I use jsdoc3 for my own needs. Here's an [example](https://github.com/mangalam-research/wed/blob/master/lib/wed/tree_updater.js). I've rebased my branch on the latest state of master but I've tested it on my own live modoboa installation by diffing the head of the branch against its base and applying this patch onto 1.0.0. I've not bothered with pep8 because I'd rather focus on functionality rather than cosmetics for now. I've noticed a problem but I think it is a preexisting architectural problem that my code revealed rather than a problem I've created. If I sort on spam score or date in the quarantine and then navigate to the webmail page, I get a error message that suggests that modoboa is trying to apply the sort I've selected in quarantine to the webmail window. The error is: ``` UID command error: BAD ['Error in IMAP command UID SORT: Unknown sort argument: SCORE'] ``` It looks like `request.session["navparams"]` is shared by the two extensions. I'm not sure what the fix is here. Is there anything that should be shared at all between the two? --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 11:20:18 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/modoboa-modoboa#1949
No description provided.