-
Notifications
You must be signed in to change notification settings - Fork 371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix order activity timeline blank entries #1317
Fix order activity timeline blank entries #1317
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@wychoong Apparently this might not be needed anymore? is that the case? |
no, this is required for a complete fix ->logExcept(array_merge(['updated_at'], static::$logExcept ?? []))
// this to support exclude additional fields,
// for example Order have additional activity log for `status` so this exclude avoid 2 entries
->logOnlyDirty()
// without this, if a record is updated without changes, it is still logged,
// can test with `$taggable->parent->touch()` |
I think my confusion is why we need to exclude the |
yes, correct for Order model there is a trait and observer to log for changes
Not really. I think the confusion probably is in lunar context, this logging is for activity, not auditing the record values. without excluding the status in this case, it will have 2 entries |
@@ -17,7 +17,8 @@ public function getActivitylogOptions(): LogOptions | |||
return LogOptions::defaults() | |||
->useLogName('lunar') | |||
->logAll() | |||
->dontSubmitEmptyLogs() | |||
->logExcept(['updated_at']); | |||
->logExcept(array_merge(['updated_at'], static::$logExcept ?? [])) /** @phpstan-ignore-line */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be better a method call, just thinking then it will likely appease the phpstan warning and be a bit more flexible in the long run?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you foreseeing a setter in register? Since it’s a static I don’t think it matters.
How would you like to see the implementation? A method to return an array or setter and getter with property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just a method to return an array should be enough, at least if it's on the trait it's easy to override.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the implementation to use a getter and setter approach so that:
- lunar core can define default excluded field
- user can add their own fields with
Order::addActivitylogExcept('another_field');
this gives the flexibility to user add their own exclusion so that they can register their own logging and log feed renderer
@wychoong assuming this is still needed, could you target |
done |
I realise this has been hanging around for a while but it looks like there are some PHPStan issues to sort |
Thanks for sorting it out. Been busy lately |
No description provided.