Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117565278
D5394.1774860202.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
2 KB
Referenced Files
None
Subscribers
None
D5394.1774860202.diff
View Options
diff --git a/src/app/Policy/Mailfilter/Modules/ExternalSenderModule.php b/src/app/Policy/Mailfilter/Modules/ExternalSenderModule.php
--- a/src/app/Policy/Mailfilter/Modules/ExternalSenderModule.php
+++ b/src/app/Policy/Mailfilter/Modules/ExternalSenderModule.php
@@ -59,10 +59,8 @@
return false;
}
- $account = $user->walletOwner();
-
// Check against the account domains list
- if ($account && $account->domains(false, false)->where('namespace', $sender_domain)->exists()) {
+ if ($user->account && $user->account->domains(false, false)->where('namespace', $sender_domain)->exists()) {
return false;
}
diff --git a/src/app/Traits/EntitleableTrait.php b/src/app/Traits/EntitleableTrait.php
--- a/src/app/Traits/EntitleableTrait.php
+++ b/src/app/Traits/EntitleableTrait.php
@@ -9,11 +9,25 @@
use App\User;
use App\Wallet;
use Carbon\Carbon;
+use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Str;
+/**
+ * @property ?User $account Account (wallet) owner
+ */
trait EntitleableTrait
{
+ /**
+ * Get the account (wallet) owner. Mutated walletOwner() result.
+ */
+ protected function account(): Attribute
+ {
+ return Attribute::make(
+ get: fn () => $this->walletOwner(),
+ );
+ }
+
/**
* Assign a package to an entitleable object. It should not have any existing entitlements.
*
diff --git a/src/app/Traits/UserConfigTrait.php b/src/app/Traits/UserConfigTrait.php
--- a/src/app/Traits/UserConfigTrait.php
+++ b/src/app/Traits/UserConfigTrait.php
@@ -59,9 +59,8 @@
// If user is not an account owner read the policy from the owner config
if ($include_account_policies) {
- $owner = $this->walletOwner();
- if ($owner && $owner->id != $this->id) {
- foreach ($owner->getConfig() as $name => $value) {
+ if ($this->account && $this->account->id != $this->id) {
+ foreach ($this->account->getConfig() as $name => $value) {
if (str_contains($name, '_policy')) {
$config[$name] = $value;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Mar 30, 8:43 AM (4 d, 12 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18800349
Default Alt Text
D5394.1774860202.diff (2 KB)
Attached To
Mode
D5394: Performance: Introduce mutable version of walletOwner()
Attached
Detach File
Event Timeline