-
Notifications
You must be signed in to change notification settings - Fork 254
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
Extending actions #8395
base: release-3.0
Are you sure you want to change the base?
Extending actions #8395
Conversation
I would change
This would allow us to define that we have multiple types that can be easily modified. |
I like what I'm seeing here! |
07d640f
to
3a6e766
Compare
'about:unknown' => true, | ||
'calendar' => ['sa' => ['clock']], | ||
'clock' => true, | ||
'dlattach' => true, | ||
'findmember' => true, | ||
'helpadmin' => true, | ||
'jsoption' => true, | ||
'likes' => true, | ||
'modifycat' => true, |
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.
These actions cannot use the new approach because they are simple callbacks that piggyback off other actions. any reason that they do not use their own objects? The only reason I can think of is that they are easter eggs and therefore require hunting around.
This is a good start, but is a limiting design. There are more MIME types to use, so something like the Strategy pattern might be a better fit |
I'm open to whatever you think works best. I am mostly thinking that limiting it to just Xml acction prevents us from migrating to JSON (and still supporting XML for BC), indicating other output formats like js/css/wav/etc. We don't need to implement the entire mime-type spectrum though. |
Right. We just need three classes: HTML, XML, JSON. A mod will be able to add more, like JSON+LD or whatever. |
Well we don't even need json right now since we don't have it in our code. It will just set up the extendability of it for when we do. |
the likes interface uses json. I only discovered that after digging around after your suggestion of return types. |
So we do have some. Well that changes my plan to introduce json later. We can then work on replacing our XML-based responses with json objects, which should simplify/improve some js logic. The simple actions you mentioned you are unsure what to do, are easter eggs as you suspected. |
Motivation
The goal is to reduce reliance on static properties for actions requiring special behavior.
Interface Definition
Below is the interface for defining action-specific behavior (
ActionInterface
). Method names probably could be improved:Deprecations
integrate_pre_log_stats
(modifyingForum::$unlogged_actions
)$unlogged_actions
via hooks.ActionInterface::canBeLogged()
to manage logging at the action level.integrate_guest_actions
(modifyingForum::$guest_access_actions
)ActionInterface::isRestrictedGuestAccessAllowed()
for guest access control.integrate_simple_actions
(modifying$simpleActions
,$simpleAreas
,$simpleSubActions
)ActionInterface::isSimpleAction()
for explicit control.integrate_simple_actions
(modifying$extraParams
,$xmlActions
)ActionInterface::isXmlAction()
for defining XML requirements.Updates to
integrate_actions
$actions
array will continue to work as they currently do.Actions\SomeClass::class
, if the class implements theActionInterface
.This addition provides a smooth transition to the new approach while maintaining compatibility with existing logic.
Backward Compatibility Impact
No backward compatibility issues are expected here. The old logic based on hooks and global properties will remain functional. Developers can incrementally adopt the new interface without requiring immediate changes to legacy code.
Request for Comments
Please share your thoughts or additional suggestions.
Question
Should we add a method for default action selection in the admin panel? This method would allow an action to specify itself as the default option for related settings in the admin panel.