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

Comment api #745

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Comment api #745

wants to merge 1 commit into from

Conversation

crnfpp
Copy link

@crnfpp crnfpp commented Sep 18, 2023

No description provided.

@netlify
Copy link

netlify bot commented Sep 18, 2023

Deploy Preview for moodledevdocs failed.

Built without sensitive environment variables

Name Link
🔨 Latest commit 4e733bd
🔍 Latest deploy log https://app.netlify.com/sites/moodledevdocs/deploys/650848af28e88700080a72d9

Copy link
Member

@andrewnicols andrewnicols left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few minor changes and we can land this. I'm sure we'll improve the docs in future. This API is long overdue a complete rewrite. It's a horrific API to work with!

@@ -97,6 +97,9 @@ Coding:
Coding_style:
- filePath: "/general/development/policies/codingstyle/index.md"
slug: "/general/development/policies/codingstyle"
Comment_API:
- filePath: "/docs/apis/core/comment/index.md"
slug: "/docs/apis/core/comment/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slugs don't have a trailing /

Suggested change
slug: "/docs/apis/core/comment/"
slug: "/docs/apis/core/comment"

@@ -90,7 +90,7 @@ The [Check API](./apis/subsystems/check/index.md) allows you to add security, pe

### Comment API (comment)

The [Comment API](https://docs.moodle.org/dev/Comment_API) allows you to save and retrieve user comments, so that you can easily add commenting to any of your code.
The [Comment API](./api/core/comment) allows you to save and retrieve user comments, so that you can easily add commenting to any of your code.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relative links should be to a file, and this should link to apis not api.

Suggested change
The [Comment API](./api/core/comment) allows you to save and retrieve user comments, so that you can easily add commenting to any of your code.
The [Comment API](./apis/core/comment/index.md) allows you to save and retrieve user comments, so that you can easily add commenting to any of your code.

Comment on lines +50 to +57
```php
$cmt = new stdclass;
$cmt->contextid = $modcontext->id;
$cmt->area = 'format_post';
$cmt->itemid = $post->id;
$options->comments = $cmt;
echo format_text($post->message, $post->messageformat, $options, $course->id)."<hr />";
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When migrating docs, we try to update to meet current coding style:

Suggested change
```php
$cmt = new stdclass;
$cmt->contextid = $modcontext->id;
$cmt->area = 'format_post';
$cmt->itemid = $post->id;
$options->comments = $cmt;
echo format_text($post->message, $post->messageformat, $options, $course->id)."<hr />";
```
```php
$cmt = new stdClass();
$cmt->contextid = $modcontext->id;
$cmt->area = 'format_post';
$cmt->itemid = $post->id;
$options->comments = $cmt;
echo format_text($post->message, $post->messageformat, $options, $course->id) . "<hr />";

Comment on lines +64 to +70
$options->area = 'database_entry';
$options->context = $context;
$options->itemid = $record->id;
$options->component = 'mod_data';
$options->showcount = true;
$comment = new comment($options);
$comment->output(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$options->area = 'database_entry';
$options->context = $context;
$options->itemid = $record->id;
$options->component = 'mod_data';
$options->showcount = true;
$comment = new comment($options);
$comment->output(false);
$options->area = 'database_entry';
$options->context = $context;
$options->itemid = $record->id;
$options->component = 'mod_data';
$options->showcount = true;
$comment = new comment($options);
$comment->output(false);

@sarjona
Copy link
Member

sarjona commented Dec 1, 2023

HI @crnfpp!
Is there any chance you can look at and fix the points raised by Andrew? If you can't, let us know and we'll try to reassign it :-)

@andrewnicols andrewnicols marked this pull request as draft May 1, 2024 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants