-
Notifications
You must be signed in to change notification settings - Fork 79
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
SilverStripe 4 compatibility #195
SilverStripe 4 compatibility #195
Conversation
* Remove CommentList and replace with a polymorphic has_one relationship * Tweaks for unit tests. Add tests for encode/decodeClassName.
|
||
before_install: | ||
- pip install --user codecov | ||
|
||
env: | ||
global: | ||
- DB=MYSQL CORE_RELEASE=3.1 | ||
- DB=MYSQL CORE_RELEASE=4 |
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.
CORE_RELEASE needs to be a branch name (i.e. master) not 4
.
@@ -1,6 +1,6 @@ | |||
<?php | |||
|
|||
Deprecation::notification_version('2.0', 'comments'); | |||
\SilverStripe\Dev\Deprecation::notification_version('2.0', 'comments'); |
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.
Needs bumping to 3.0.
'CommentingController//$Action/$ID/$OtherID': 'CommentingController' | ||
'PageComments/$Action/$ID/$OtherID': 'CommentingController' | ||
'PageComments_Controller/$Action/$ID/$OtherID': 'CommentingController' | ||
CommentingController//$Action/$ID/$OtherID: SilverStripe\Comments\Controllers\CommentingController |
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.
This is a duplicate route to the comments
above. I suggest moving this to a unified route.
'PageComments_Controller/$Action/$ID/$OtherID': 'CommentingController' | ||
CommentingController//$Action/$ID/$OtherID: SilverStripe\Comments\Controllers\CommentingController | ||
PageComments/$Action/$ID/$OtherID: SilverStripe\Comments\Controllers\CommentingController | ||
PageCommentsController/$Action/$ID/$OtherID: SilverStripe\Comments\Controllers\CommentingController |
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.
Do we need these two still?
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.
Removed
/** | ||
* @package comments | ||
*/ | ||
class CommentsGridFieldBulkAction extends GridFieldBulkActionHandler |
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.
What's the value in this? Just use GridFieldBulkActionHandler.
{ | ||
|
||
/** | ||
* {@inheritDoc} |
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.
{@inheritdoc} with nothing else is redundant; docs automatically inherit.
use SilverStripe\Forms\GridField\GridFieldDataColumns; | ||
|
||
/** | ||
* @package comments |
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 don't think we're doing @package
anymore. Namespaces are enough.
@@ -66,7 +74,7 @@ public static function remove($class) | |||
public static function has_commenting($class) | |||
{ | |||
Deprecation::notice('2.0', 'Using Commenting::has_commenting is deprecated. Please use the config API instead'); |
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.
Anything 2.0 deprecated can be removed.
@@ -414,7 +444,7 @@ public function getRssLink() | |||
*/ | |||
public function getCommentRSSLink() | |||
{ | |||
return Controller::join_links(Director::baseURL(), 'CommentingController/rss'); |
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.
You can now do Director::absoluteLink('comments/rss')
and it will automatically work with base url.
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.
Updated - assumed you meant Director::absoluteURL
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.
Ah yep. :)
public function run($request) | ||
{ | ||
// Set the class names to fully qualified class names first | ||
$remapping = Config::inst()->get('SilverStripe\\ORM\\DatabaseAdmin', 'classname_value_remapping'); |
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.
You need a check to see if BaseClass is a field on Comment; If it's not skip the upgrade.
… tweaks to class names. Use Director::absoluteURL.
Thanks @tractorcow - I've updated with your comments and pushed |
This namespace changes once BulkManager gets updated to ss4.
FIX namespacing for BulkManager
Tests don't pass due to issues upstream with the bulk editing tool dependency, but I think this should be merged, and we mark master as unstable for the time being. |
Aside from the expected changes such as namespacing, there are some other changes made in this pull request to ensure the module works with the SS4 framework.
API changes
CommentList
is removed and replaced with a polymorphic has_one relationship in theCommentsExtension
/CommentingController/
to/comments/
CommentingController::encodeClassName
anddecodeClassName
are added to swap\
for-
to ensure they workBaseClass
property ofComment
is removed as it was conflicting with the concrete methodDataObject::baseClass
. Since SilverStripe 4.0, the faux poly-has-oneCommentList
is no longer required, so this property is removed and replaced with the nativeParentClass
that comes with the has_one:Parent
BaseClass
values to FQ class names (since BaseClass != ClassName so not covered byDatabaseAdmin.classname_value_remapping
, and move the value of the field toParentClass
(the new field). The numericParentID
field has a different purpose semantically, but remains the same in terms of the public API.sake dev/tasks/MigrateCommentParentsTask
Deprecations
Comment::getParent
is deprecated, useComment::Parent
(has_one relationship) insteadTest/build changes
CommentingControllerTest
class has been updated to not automatically follow redirects unless specified to. This is to ensure that our assertions are accurate reflections of the code wherever possibleQuestions
i18n.js
for the frontend?Link()
does not exist) - existing issueThings I didn't do
Blockers
Resolves #194