Rename comments --> notes

This commit is contained in:
shamoon
2023-03-17 16:36:08 -07:00
parent 78cb8cff69
commit 5108bbc192
45 changed files with 540 additions and 528 deletions

View File

@@ -17,28 +17,28 @@ describe('document-detail', () => {
req.reply({ result: 'OK' })
}).as('saveDoc')
cy.fixture('documents/1/comments.json').then((commentsJson) => {
cy.fixture('documents/1/notes.json').then((notesJson) => {
cy.intercept(
'GET',
'http://localhost:8000/api/documents/1/comments/',
'http://localhost:8000/api/documents/1/notes/',
(req) => {
req.reply(commentsJson.filter((c) => c.id != 10)) // 3
req.reply(notesJson.filter((c) => c.id != 10)) // 3
}
)
cy.intercept(
'DELETE',
'http://localhost:8000/api/documents/1/comments/?id=9',
'http://localhost:8000/api/documents/1/notes/?id=9',
(req) => {
req.reply(commentsJson.filter((c) => c.id != 9 && c.id != 10)) // 2
req.reply(notesJson.filter((c) => c.id != 9 && c.id != 10)) // 2
}
)
cy.intercept(
'POST',
'http://localhost:8000/api/documents/1/comments/',
'http://localhost:8000/api/documents/1/notes/',
(req) => {
req.reply(commentsJson) // 4
req.reply(notesJson) // 4
}
)
})
@@ -75,48 +75,40 @@ describe('document-detail', () => {
cy.get('pdf-viewer').should('be.visible')
})
it('should show a list of comments', () => {
cy.wait(1000)
.get('a')
.contains('Comments')
.click({ force: true })
.wait(1000)
cy.get('app-document-comments').find('.card').its('length').should('eq', 3)
it('should show a list of notes', () => {
cy.wait(1000).get('a').contains('Notes').click({ force: true }).wait(1000)
cy.get('app-document-notes').find('.card').its('length').should('eq', 3)
})
it('should support comment deletion', () => {
cy.wait(1000).get('a').contains('Comments').click().wait(1000)
cy.get('app-document-comments')
it('should support note deletion', () => {
cy.wait(1000).get('a').contains('Notes').click().wait(1000)
cy.get('app-document-notes')
.find('.card')
.first()
.find('button')
.click({ force: true })
.wait(500)
cy.get('app-document-comments').find('.card').its('length').should('eq', 2)
cy.get('app-document-notes').find('.card').its('length').should('eq', 2)
})
it('should support comment insertion', () => {
cy.wait(1000).get('a').contains('Comments').click().wait(1000)
cy.get('app-document-comments')
it('should support note insertion', () => {
cy.wait(1000).get('a').contains('Notes').click().wait(1000)
cy.get('app-document-notes')
.find('form textarea')
.type('Testing new comment')
.type('Testing new note')
.wait(500)
cy.get('app-document-comments').find('form button').click().wait(1500)
cy.get('app-document-comments').find('.card').its('length').should('eq', 4)
cy.get('app-document-notes').find('form button').click().wait(1500)
cy.get('app-document-notes').find('.card').its('length').should('eq', 4)
})
it('should support navigation to comments tab by url', () => {
cy.visit('/documents/1/comments')
cy.get('app-document-comments').should('exist')
it('should support navigation to notes tab by url', () => {
cy.visit('/documents/1/notes')
cy.get('app-document-notes').should('exist')
})
it('should dynamically update comment counts', () => {
cy.visit('/documents/1/comments')
cy.get('app-document-comments').within(() => cy.contains('Delete').click())
cy.get('ul.nav')
.find('li')
.contains('Comments')
.find('.badge')
.contains('2')
it('should dynamically update note counts', () => {
cy.visit('/documents/1/notes')
cy.get('app-document-notes').within(() => cy.contains('Delete').click())
cy.get('ul.nav').find('li').contains('Notes').find('.badge').contains('2')
})
})

View File

@@ -1,46 +0,0 @@
[
{
"id": 10,
"comment": "Testing new comment",
"created": "2022-08-08T04:24:55.176008Z",
"user": {
"id": 1,
"username": "user2",
"first_name": "",
"last_name": ""
}
},
{
"id": 9,
"comment": "Testing one more time",
"created": "2022-02-18T04:24:55.176008Z",
"user": {
"id": 2,
"username": "user1",
"first_name": "",
"last_name": ""
}
},
{
"id": 8,
"comment": "Another comment",
"created": "2021-11-08T04:24:47.925042Z",
"user": {
"id": 2,
"username": "user33",
"first_name": "",
"last_name": ""
}
},
{
"id": 7,
"comment": "Cupcake ipsum dolor sit amet cheesecake candy cookie tiramisu. Donut chocolate chupa chups macaroon brownie halvah pie cheesecake gummies. Sweet chocolate bar candy donut gummi bears bear claw liquorice bonbon shortbread.\n\nDonut chocolate bar candy wafer wafer tiramisu. Gummies chocolate cake muffin toffee carrot cake macaroon. Toffee toffee jelly beans danish lollipop cake.",
"created": "2021-02-08T02:37:49.724132Z",
"user": {
"id": 3,
"username": "admin",
"first_name": "",
"last_name": ""
}
}
]

View File

@@ -0,0 +1,26 @@
[
{
"id": 10,
"note": "Testing new note",
"created": "2022-08-08T04:24:55.176008Z",
"user": 3
},
{
"id": 9,
"note": "Testing one more time",
"created": "2022-02-18T04:24:55.176008Z",
"user": 15
},
{
"id": 8,
"note": "Another note",
"created": "2021-11-08T04:24:47.925042Z",
"user": 3
},
{
"id": 7,
"note": "Cupcake ipsum dolor sit amet cheesecake candy cookie tiramisu. Donut chocolate chupa chups macaroon brownie halvah pie cheesecake gummies. Sweet chocolate bar candy donut gummi bears bear claw liquorice bonbon shortbread.\n\nDonut chocolate bar candy wafer wafer tiramisu. Gummies chocolate cake muffin toffee carrot cake macaroon. Toffee toffee jelly beans danish lollipop cake.",
"created": "2021-02-08T02:37:49.724132Z",
"user": 3
}
]

View File

@@ -22,39 +22,24 @@
"archived_file_name": "2022-03-22 no latin title.pdf",
"owner": null,
"permissions": [],
"comments": [
"notes": [
{
"id": 30,
"comment": "One more time",
"created": "2023-03-17T22:02:14.357575Z",
"user": {
"id": 2,
"username": "username",
"first_name": "",
"last_name": ""
}
"id": 9,
"note": "Testing one more time",
"created": "2022-02-18T04:24:55.176008Z",
"user": 15
},
{
"id": 6,
"comment": "Lets keep going",
"created": "2023-03-16T06:57:32.014027Z",
"user": {
"id": 2,
"username": "username",
"first_name": "",
"last_name": ""
}
"id": 8,
"note": "Another note",
"created": "2021-11-08T04:24:47.925042Z",
"user": 3
},
{
"id": 5,
"comment": "And just one more",
"created": "2023-03-16T06:57:27.022729Z",
"user": {
"id": 2,
"username": "username",
"first_name": "",
"last_name": ""
}
"id": 7,
"note": "Cupcake ipsum dolor sit amet cheesecake candy cookie tiramisu. Donut chocolate chupa chups macaroon brownie halvah pie cheesecake gummies. Sweet chocolate bar candy donut gummi bears bear claw liquorice bonbon shortbread.\n\nDonut chocolate bar candy wafer wafer tiramisu. Gummies chocolate cake muffin toffee carrot cake macaroon. Toffee toffee jelly beans danish lollipop cake.",
"created": "2021-02-08T02:37:49.724132Z",
"user": 3
}
]
},
@@ -75,7 +60,7 @@
"archived_file_name": "2022-03-23 llorem ipsum dolor sit amet.pdf",
"owner": null,
"permissions": [],
"comments": []
"notes": []
},
{
"id": 3,
@@ -96,7 +81,7 @@
"archived_file_name": "2022-03-24 dolor.pdf",
"owner": null,
"permissions": [],
"comments": []
"notes": []
},
{
"id": 4,
@@ -117,7 +102,7 @@
"archived_file_name": "2022-06-01 sit amet.pdf",
"owner": null,
"permissions": [],
"comments": []
"notes": []
}
]
}

View File

@@ -11,10 +11,10 @@
"change_user",
"delete_user",
"view_user",
"add_comment",
"change_comment",
"delete_comment",
"view_comment"
"add_note",
"change_note",
"delete_note",
"view_note"
]
},
{
@@ -73,10 +73,10 @@
"change_task",
"delete_task",
"view_task",
"add_comment",
"change_comment",
"delete_comment",
"view_comment",
"add_note",
"change_note",
"delete_note",
"view_note",
"add_correspondent",
"change_correspondent",
"delete_correspondent",

View File

@@ -94,10 +94,10 @@
"change_task",
"delete_task",
"view_task",
"add_comment",
"change_comment",
"delete_comment",
"view_comment",
"add_note",
"change_note",
"delete_note",
"view_note",
"add_correspondent",
"change_correspondent",
"delete_correspondent",

View File

@@ -74,7 +74,7 @@
"change_task",
"delete_task",
"view_task",
"add_comment",
"add_note",
"add_frontendsettings",
"change_frontendsettings",
"delete_frontendsettings",

View File

@@ -30,7 +30,7 @@
"django_celery_results.delete_taskresult",
"paperless_mail.add_mailaccount",
"auth.change_group",
"documents.add_comment",
"documents.add_note",
"paperless_mail.delete_mailaccount",
"authtoken.delete_tokenproxy",
"guardian.delete_groupobjectpermission",
@@ -44,7 +44,7 @@
"documents.add_documenttype",
"django_q.change_success",
"documents.delete_tag",
"documents.change_comment",
"documents.change_note",
"django_q.delete_task",
"documents.add_savedviewfilterrule",
"django_q.view_task",
@@ -59,7 +59,7 @@
"documents.add_savedview",
"auth.delete_user",
"documents.view_log",
"documents.view_comment",
"documents.view_note",
"guardian.change_groupobjectpermission",
"sessions.delete_session",
"django_q.change_failure",
@@ -139,7 +139,7 @@
"django_celery_results.view_taskresult",
"contenttypes.add_contenttype",
"django_q.delete_success",
"documents.delete_comment",
"documents.delete_note",
"django_q.add_failure",
"guardian.add_userobjectpermission",
"sessions.view_session",
@@ -216,10 +216,10 @@
"change_task",
"delete_task",
"view_task",
"add_comment",
"change_comment",
"delete_comment",
"view_comment",
"add_note",
"change_note",
"delete_note",
"view_note",
"add_frontendsettings",
"change_frontendsettings",
"delete_frontendsettings",
@@ -256,7 +256,7 @@
"django_celery_results.delete_taskresult",
"authtoken.change_token",
"auth.change_group",
"documents.add_comment",
"documents.add_note",
"authtoken.delete_tokenproxy",
"documents.view_documenttype",
"contenttypes.delete_contenttype",
@@ -285,7 +285,7 @@
"django_q.change_task",
"sessions.add_session",
"documents.change_taskattributes",
"documents.change_comment",
"documents.change_note",
"django_q.delete_task",
"django_q.delete_ormq",
"auth.change_permission",
@@ -311,7 +311,7 @@
"documents.view_document",
"documents.add_savedview",
"django_q.view_failure",
"documents.view_comment",
"documents.view_note",
"documents.view_log",
"documents.add_log",
"documents.change_savedview",
@@ -324,7 +324,7 @@
"django_celery_results.view_taskresult",
"contenttypes.add_contenttype",
"django_q.delete_success",
"documents.delete_comment",
"documents.delete_note",
"django_q.add_failure",
"sessions.view_session",
"contenttypes.view_contenttype",
@@ -373,7 +373,7 @@
"django_celery_results.delete_taskresult",
"authtoken.change_token",
"auth.change_group",
"documents.add_comment",
"documents.add_note",
"authtoken.delete_tokenproxy",
"documents.view_documenttype",
"contenttypes.delete_contenttype",
@@ -402,7 +402,7 @@
"django_q.change_task",
"sessions.add_session",
"documents.change_taskattributes",
"documents.change_comment",
"documents.change_note",
"django_q.delete_task",
"django_q.delete_ormq",
"auth.change_permission",
@@ -429,7 +429,7 @@
"documents.view_document",
"documents.add_savedview",
"django_q.view_failure",
"documents.view_comment",
"documents.view_note",
"documents.view_log",
"auth.delete_user",
"documents.add_log",
@@ -443,7 +443,7 @@
"django_celery_results.view_taskresult",
"contenttypes.add_contenttype",
"django_q.delete_success",
"documents.delete_comment",
"documents.delete_note",
"django_q.add_failure",
"sessions.view_session",
"contenttypes.view_contenttype",