Skip to content
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

Merged
merged 8 commits into from
Oct 17, 2016
Merged

1362 editable post dates #1440

merged 8 commits into from
Oct 17, 2016

Conversation

willdoran
Copy link
Contributor

@willdoran willdoran commented Oct 13, 2016

This pull request makes the following changes:

  • Adding post date
  • Migration
  • Test
  • Validation

Test these changes by:

Fixes #1362

Ping @ushahidi/platform


This change is Reviewable

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 70.143% when pulling 571a90b on 1362-editable-post-dates into 4e71e29 on develop.

@@ -79,6 +80,7 @@ protected function getDefinition()
'status' => 'string',
'created' => 'int',
'updated' => 'int',
'post_date' => 'string',
Copy link
Contributor

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']));
Copy link
Contributor

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

Copy link
Contributor Author

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'];
Copy link
Contributor

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

Copy link
Contributor Author

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();
Copy link
Contributor

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

Copy link
Contributor Author

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?

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.2%) to 70.124% when pulling 25e479e on 1362-editable-post-dates into 4e71e29 on develop.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 70.199% when pulling 5d710b6 on 1362-editable-post-dates into 4e71e29 on develop.

@rjmackay rjmackay merged commit 4f4db83 into develop Oct 17, 2016
@willdoran willdoran deleted the 1362-editable-post-dates branch April 26, 2017 19:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants