Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117902435
D2839.1775383229.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D2839.1775383229.diff
View Options
diff --git a/src/app/Policy/Greylist/Request.php b/src/app/Policy/Greylist/Request.php
--- a/src/app/Policy/Greylist/Request.php
+++ b/src/app/Policy/Greylist/Request.php
@@ -82,26 +82,9 @@
$this->senderLocal = substr($this->senderLocal, 0, 255);
}
- $entry = $this->findConnectsCollectionRecent()->orderBy('updated_at')->first();
-
- if (!$entry) {
- // purge all entries to avoid a unique constraint violation.
+ // Purge all old information if we have no recent entries
+ if (!$this->findConnectsCollectionRecent()->exists()) {
$this->findConnectsCollection()->delete();
-
- $entry = Connect::create(
- [
- 'sender_local' => $this->senderLocal,
- 'sender_domain' => $this->senderDomain,
- 'net_id' => $this->netID,
- 'net_type' => $this->netType,
- 'recipient_hash' => $this->recipientHash,
- 'recipient_id' => $this->recipientID,
- 'recipient_type' => $this->recipientType,
- 'connect_count' => 1,
- 'created_at' => $this->timestamp,
- 'updated_at' => $this->timestamp
- ]
- );
}
// See if the recipient opted-out of the feature
@@ -159,10 +142,10 @@
]
)
->whereDate('updated_at', '>=', $cutoffDate)
- ->limit(5)->count();
+ ->limit(4)->count();
- // Automatically create a whitelist if we have at least 5 messages from the sender
- if ($count >= 5) {
+ // Automatically create a whitelist if we have at least 5 (4 existing plus this) messages from the sender
+ if ($count >= 4) {
$this->whitelist = Whitelist::create(
[
'sender_domain' => $this->senderDomain,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 5, 10:00 AM (6 h, 23 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18821601
Default Alt Text
D2839.1775383229.diff (1 KB)
Attached To
Mode
D2839: Greylist/Request: Avoid unnecessary queries
Attached
Detach File
Event Timeline