Skip to content
This repository has been archived by the owner on Oct 24, 2018. It is now read-only.

Feature/598 comment htmlpage thread contents endpoints #91

Merged

Conversation

inkhey
Copy link
Contributor

@inkhey inkhey commented Jun 21, 2018

require #88

  • add endpoint for comments: get/add/delete + test related
  • add endpoint for html_content + test related
  • add endpoint for threads + test related

Bug/Missing:

Others:

closes tracim/tracim#598
closes tracim/tracim#601
closes tracim/tracim#606
closes tracim/tracim#597

@coveralls
Copy link

Pull Request Test Coverage Report for Build 264

  • 510 of 517 (98.65%) changed or added relevant lines in 20 files are covered.
  • 7 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+1.07%) to 83.949%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tracim/models/context_models.py 28 29 96.55%
tracim/lib/utils/authorization.py 11 12 91.67%
tracim/lib/core/content.py 14 16 87.5%
tracim/lib/utils/request.py 21 24 87.5%
Files with Coverage Reduction New Missed Lines %
tracim/lib/core/content.py 1 72.66%
tracim/models/context_models.py 1 97.59%
tracim/lib/utils/request.py 5 87.5%
Totals Coverage Status
Change from base Build 236: 1.07%
Covered Lines: 6391
Relevant Lines: 7613

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 21, 2018

Pull Request Test Coverage Report for Build 305

  • 1225 of 1260 (97.22%) changed or added relevant lines in 27 files are covered.
  • 30 unchanged lines in 7 files lost coverage.
  • Overall coverage increased (+2.3%) to 85.499%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tracim/lib/core/content.py 18 20 90.0%
tracim/lib/utils/authorization.py 45 47 95.74%
tracim/views/contents_api/html_document_controller.py 105 107 98.13%
tracim/views/contents_api/comment_controller.py 80 82 97.56%
tracim/views/contents_api/threads_controller.py 104 106 98.11%
tracim/models/context_models.py 121 124 97.58%
tracim/lib/utils/request.py 44 66 66.67%
Files with Coverage Reduction New Missed Lines %
tracim/lib/utils/request.py 1 82.14%
tracim/lib/utils/authorization.py 2 94.62%
tracim/views/core_api/session_controller.py 2 100.0%
tracim/views/core_api/system_controller.py 2 100.0%
tracim/views/core_api/user_controller.py 2 100.0%
tracim/views/core_api/workspace_controller.py 2 100.0%
tracim/command/database.py 19 33.33%
Totals Coverage Status
Change from base Build 272: 2.3%
Covered Lines: 7305
Relevant Lines: 8544

💛 - Coveralls

@inkhey inkhey changed the title WIP: Feature/598 comment htmlpage thread contents endpoints Feature/598 comment htmlpage thread contents endpoints Jun 28, 2018
@inkhey inkhey changed the title Feature/598 comment htmlpage thread contents endpoints WIP:Feature/598 comment htmlpage thread contents endpoints Jun 29, 2018
@inkhey inkhey changed the title WIP:Feature/598 comment htmlpage thread contents endpoints Feature/598 comment htmlpage thread contents endpoints Jun 29, 2018
@inkhey inkhey changed the title Feature/598 comment htmlpage thread contents endpoints WIP:Feature/598 comment htmlpage thread contents endpoints Jun 29, 2018
@Skylsmoi Skylsmoi changed the title WIP:Feature/598 comment htmlpage thread contents endpoints Feature/598 comment htmlpage thread contents endpoints Jul 2, 2018
@@ -152,6 +152,13 @@ For example, with default config:
# launch your favorite web-browser
firefox http://localhost:6543/api/v2/doc/

## Roles, profile and access rights

In Tracim, only some user can access to some informations, this is also true in
Copy link
Collaborator

Choose a reason for hiding this comment

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

this is also true in Tracim REST API => this is checked at REST API layer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should also be checked in webdav layer.

Copy link
Collaborator

Choose a reason for hiding this comment

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

actually, it MUST be check in webdav layer too. It's implemented or not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should check this better, but i do think there is actually only restriction on visible workspaces according to user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

)
bob_content_api.create_comment(
parent=best_cake_thread,
content='<p>What about Apple Pie ? There are Awesome !</p>',
Copy link
Collaborator

Choose a reason for hiding this comment

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

in English, there's no space before punctuation : What about Apple Pie ? There are Awesome ! => What about Apple Pie? There are Awesome!

)
reader_content_api.create_comment(
parent=best_cake_thread,
content='<p>You are right, but Kouign-amann are clearly better.</p>',
Copy link
Collaborator

Choose a reason for hiding this comment

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

same here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not understand this one, content selection is maybe uncorrect .

):
bob_content_api.update_content(
item=best_cake_thread,
new_content='What is the best cake ?',
Copy link
Collaborator

Choose a reason for hiding this comment

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

same remark

@@ -161,6 +164,10 @@ def show(
def get_content_in_context(self, content: Content):
return ContentInContext(content, self._session, self._config)

def get_revision_in_context(self, revision: ContentRevisionRO):
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing typing

author = marshmallow.fields.Nested(UserDigestSchema)


class ThreadRevisionSchema(RevisionSchema):
Copy link
Collaborator

Choose a reason for hiding this comment

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

same remark. Define a unique TextBasedContentRevisionSchema used in place of ThreadRevisionSchema and HtmlDocumentRevisionSchema

Copy link
Contributor Author

Choose a reason for hiding this comment

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


####

class CommentSchema(marshmallow.Schema):
Copy link
Collaborator

Choose a reason for hiding this comment

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

CommentSchema can be overwritten with TextBasedContentSchema, doesnt it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably, tracim/tracim#618

)


class ContentModifySchema(marshmallow.Schema):
Copy link
Collaborator

Choose a reason for hiding this comment

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

If the schema is not intended to be used as is, maybe rename it to something more clear. ContentModifyAbstractSchema ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to be done here : tracim/tracim#618

)


class HtmlDocumentModifySchema(ContentModifySchema):
Copy link
Collaborator

Choose a reason for hiding this comment

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

This schema is to rename to TextBasedContentModifySchema and to use in place of HTMLDocumentUpdate and ThreadUpdate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

to be done in same time as tracim/tracim#618


@hapic.with_api_doc(tags=[COMMENT_ENDPOINTS_TAG])
@hapic.handle_exception(NotAuthenticated, HTTPStatus.UNAUTHORIZED)
@hapic.handle_exception(InsufficientUserWorkspaceRole, HTTPStatus.FORBIDDEN)
Copy link
Collaborator

Choose a reason for hiding this comment

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

InsufficientUserWorkspaceRole is probably to rename to InsufficientUserRoleInWorkspace. The reason for that is "it's understandable as naturally read"

@lebouquetin lebouquetin merged commit 6056263 into develop Jul 4, 2018
@inkhey inkhey deleted the feature/598_comment_htmlpage_thread_contents_endpoints branch July 17, 2018 14:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants