-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Notes 100: Comment Delete #1191
base: main
Are you sure you want to change the base?
Changes from 9 commits
d880aed
cba657b
3d1d4e3
80d8d0d
31471e5
9ab9e69
70a5925
5569da7
c53803e
ca17361
e88b57d
3568501
fd30fef
6d15768
d37f1c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import '@percy/cypress' | ||
import { | ||
homepageSetup, | ||
returningUserVisitsHomepageWaitForModel, | ||
auth0Login, | ||
} from '../../support/utils' | ||
|
||
/** {@link https://github.com/bldrs-ai/Share/issues/1187} */ | ||
describe('Notes 100: Comment delete', () => { | ||
beforeEach(homepageSetup) | ||
context('Returning user visits homepage', () => { | ||
beforeEach(returningUserVisitsHomepageWaitForModel) | ||
context('Open Notes > first note', () => { | ||
beforeEach(() => { | ||
cy.get('[data-testid="control-button-notes"]').click() | ||
cy.get('[data-testid="list-notes"] :nth-child(1) > [data-testid="note-body"]').first().click() | ||
}) | ||
it('Deleted comment disappears from the list', () => { | ||
auth0Login() | ||
cy.get(`[data-testid="list-notes"] > :nth-child(3) | ||
> [data-testid="note-card"] > .MuiCardActions-root > .MuiBox-root > [data-testid="deleteComment"]`).click() | ||
cy.get('[data-testid="list-notes"] > :nth-child(3) > [data-testid="note-card"]').should('not.contain', 'testComment_1') | ||
cy.percySnapshot() | ||
}) | ||
}) | ||
}) | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import AddCommentOutlinedIcon from '@mui/icons-material/AddCommentOutlined' | |
import CheckIcon from '@mui/icons-material/Check' | ||
import ForumOutlinedIcon from '@mui/icons-material/ForumOutlined' | ||
import GitHubIcon from '@mui/icons-material/GitHub' | ||
import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline' | ||
import PhotoCameraIcon from '@mui/icons-material/PhotoCamera' | ||
import CameraIcon from '../../assets/icons/Camera.svg' | ||
import PlaceMarkIcon from '../../assets/icons/PlaceMark.svg' | ||
|
@@ -23,6 +24,7 @@ import ShareIcon from '../../assets/icons/Share.svg' | |
*/ | ||
export default function NoteFooter({ | ||
accessToken, | ||
deleteComment, | ||
editMode, | ||
embeddedCameras, | ||
id, | ||
|
@@ -63,13 +65,14 @@ export default function NoteFooter({ | |
'_blank') | ||
} | ||
|
||
|
||
return ( | ||
<CardActions> | ||
{isNote && | ||
<TooltipIconButton | ||
title='Open in Github' | ||
size='small' | ||
placement='bottom' | ||
placement='top' | ||
onClick={openGithubIssue} | ||
icon={<GitHubIcon className='icon-share'/>} | ||
aboutInfo={false} | ||
|
@@ -80,7 +83,7 @@ export default function NoteFooter({ | |
<TooltipIconButton | ||
title='Show the camera view' | ||
size='small' | ||
placement='bottom' | ||
placement='top' | ||
onClick={onClickCamera} | ||
icon={<CameraIcon className='icon-share'/>} | ||
aboutInfo={false} | ||
|
@@ -90,7 +93,7 @@ export default function NoteFooter({ | |
<TooltipIconButton | ||
title='Share' | ||
size='small' | ||
placement='bottom' | ||
placement='top' | ||
onClick={() => { | ||
onClickShare() | ||
setShareIssue(!shareIssue) | ||
|
@@ -113,7 +116,7 @@ export default function NoteFooter({ | |
<TooltipIconButton | ||
title='Place Mark' | ||
size='small' | ||
placement='bottom' | ||
placement='top' | ||
onClick={() => { | ||
togglePlaceMarkActive(id) | ||
}} | ||
|
@@ -130,48 +133,60 @@ export default function NoteFooter({ | |
<TooltipIconButton | ||
title='Take Screenshot' | ||
size='small' | ||
placement='bottom' | ||
placement='top' | ||
onClick={() => { | ||
setScreenshotUri(viewer.takeScreenshot()) | ||
}} | ||
icon={<PhotoCameraIcon className='icon-share'/>} | ||
/> | ||
} | ||
|
||
{editMode && | ||
<TooltipIconButton | ||
title='Save' | ||
placement='left' | ||
icon={<CheckIcon className='icon-share'/>} | ||
onClick={() => submitUpdate(repository, accessToken, id)} | ||
/> | ||
} | ||
|
||
{isNote && !selected && | ||
<TooltipIconButton | ||
title='Add Comment' | ||
size='small' | ||
placement='bottom' | ||
placement='top' | ||
selected={showCreateComment} | ||
onClick={selectCard} | ||
icon={<AddCommentOutlinedIcon className='icon-share'/>} | ||
/> | ||
} | ||
{editMode && | ||
<Box sx={{marginLeft: 'auto', padding: '0 0.5em'}}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could the left-padding be moved to the parent to remove it from have it repeated in these 3 components? |
||
<TooltipIconButton | ||
title='Save' | ||
placement='top' | ||
icon={<CheckIcon className='icon-share'/>} | ||
onClick={() => submitUpdate(repository, accessToken, id)} | ||
/> | ||
</Box> | ||
} | ||
|
||
{numberOfComments > 0 && !editMode && | ||
<Box sx={{marginLeft: 'auto', padding: '0 0.5em'}}> | ||
{!selected && | ||
<TooltipIconButton | ||
title='Discussion' | ||
size='small' | ||
placement='bottom' | ||
placement='top' | ||
onClick={selectCard} | ||
icon={<ForumOutlinedIcon className='icon-share'/>} | ||
/> | ||
} | ||
{!selected && numberOfComments} | ||
{!selected && numberOfComments} | ||
</Box> | ||
} | ||
{!isNote && user && username === user.nickname && | ||
<Box sx={{marginLeft: 'auto', padding: '0 0 0 0.5em'}}> | ||
<TooltipIconButton | ||
title='Delete' | ||
placement='top' | ||
buttonTestId='deleteComment' | ||
icon={<DeleteOutlineIcon className='icon-share'/>} | ||
onClick={() => deleteComment(id)} | ||
/> | ||
</Box> | ||
} | ||
</CardActions> | ||
) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -235,7 +235,7 @@ function githubHandlers(githubStore) { | |
rest.delete(`${GH_BASE}/repos/:org/:repo/issues/comments/:commentId`, (req, res, ctx) => { | ||
const {org, repo, commentId} = req.params | ||
|
||
if (org !== 'bldrs-ai' || repo !== 'Share' || !commentId) { | ||
if (org !== 'pablo-mayrgundter' || repo !== 'Share' || !commentId) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's move these to one of the mock test IDs to make it clear that it's not prod data, and also to free my ghost from the machine :) |
||
return res(ctx.status(httpNotFound)) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ describe('net/github/Comments', () => { | |
}) | ||
|
||
it('successfully delete comment', async () => { | ||
const res = await deleteComment({orgName: 'bldrs-ai', name: 'Share'}, 1) | ||
const res = await deleteComment({orgName: 'pablo-mayrgundter', name: 'Share'}, 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
expect(res.status).toEqual(httpOK) | ||
}) | ||
}) |
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.
I think we planned to use return statuses to set comments instead of filtering, like in #1200
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.
@pablo-mayrgundter getting 204 with the data of the response object undefined.
ChatGPT:
A 204 No Content status code indicates that the server successfully processed the request, but is not returning any content. This is typical for a POST request where the server does not return a response body.