-
Notifications
You must be signed in to change notification settings - Fork 505
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
1362 editable post dates #1440
1362 editable post dates #1440
Conversation
@@ -79,6 +80,7 @@ protected function getDefinition() | |||
'status' => 'string', | |||
'created' => 'int', | |||
'updated' => 'int', | |||
'post_date' => 'string', |
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.
We can use *timestamp
here and it should run the value through strtotime
@@ -818,6 +818,10 @@ public function create(Entity $entity) | |||
|
|||
// Remove attribute values and tags | |||
unset($post['values'], $post['tags'], $post['completed_stages'], $post['sets'], $post['source'], $post['color']); | |||
// Convert post_date to mysql format | |||
if(array_key_exists('post_date', $post)) { | |||
$post['post_date'] = date("Y-m-d H:i:s", strtotime($post['post_date'])); |
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 should happen on the entity so its in a consistent format there
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.
moved
@@ -61,7 +61,7 @@ class PostAuthorizer implements Authorizer, Permissionable | |||
*/ | |||
protected function getAllPrivs() | |||
{ | |||
return ['read', 'create', 'update', 'delete', 'search', 'change_status']; | |||
return ['read', 'create', 'update', 'delete', 'search', 'change_status', 'change_timestamp']; |
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.
Don't need this change_timestamp isn't a separate permission, just part of update
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.
done
->addColumn('post_date', 'datetime', [ | ||
'null' => true, | ||
]) | ||
->update(); |
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.
Need to populate this for all existing posts too
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.
How do you mean? As in a value default?
This pull request makes the following changes:
Test these changes by:
Fixes #1362
Ping @ushahidi/platform
This change is