-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix(cards): comment #4458
Merged
Merged
fix(cards): comment #4458
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
6b9580d
add mutations
ariunzayarin beb5954
little fix
munkhsaikhan cae6959
Translation purchase (#4442)
uuganaa1007 001ae59
Add-webmessenger-in-opensource-customers (#4408)
soyombo-baterdene 93ab85b
update(notifications): add index
munkhsaikhan 284276a
update(cards): little
munkhsaikhan 8be5227
remove branches departments for currentuser on ui
munkhsaikhan 027e9f4
stop doing core to core RPC
dulguun0225 7f89e96
enable query deduplication
dulguun0225 b91e85c
fix(integration) fix required of channels field in creating integrations
Gerelsukh 0992af7
fix loading everywhere bug
8685cea
perf(client portal) improve client portal comments logic
nandinboldn 8c46ab5
add isEnabled (#4453)
ariunzayarin 68d2e23
fix(nav): more button style (#4455)
ariunzayarin b40e3a6
fix email widget shrink (#4456)
ariunzayarin 7fbf80a
add comment from team
ariunzayarin 66d3c9b
see user details
nandinboldn 533d424
fix commentor name and avatar
ariunzayarin d615c0e
Merge branch 'staging' into fix-comment
ariunzayarin e9928dc
little fix
ariunzayarin 434d8c0
add refetch
ariunzayarin 8c498c7
refactor
ariunzayarin de452b3
refactor
ariunzayarin dcdc97a
liitle fix
ariunzayarin f68abf2
add remove action
ariunzayarin 861000b
merge with staging
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,25 +11,19 @@ import { | |
CommentContent | ||
} from '@erxes/ui-settings/src/styles'; | ||
import { ColorButton } from '../../boards/styles/common'; | ||
import { gql, useQuery, useMutation } from '@apollo/client'; | ||
import { gql, useQuery } from '@apollo/client'; | ||
import dayjs from 'dayjs'; | ||
import { queries, mutations } from '../graphql/'; | ||
import { queries } from '../graphql/'; | ||
|
||
function Comment(item) { | ||
const typeId = item.item._id; | ||
const type = item.item.stage.type; | ||
|
||
const { loading, data = {} as any } = useQuery( | ||
gql(queries.clientPortalComments), | ||
{ | ||
variables: { typeId: typeId, type: type }, | ||
fetchPolicy: 'network-only', | ||
notifyOnNetworkStatusChange: true | ||
} | ||
); | ||
const [clientPortalCommentsRemove] = useMutation( | ||
gql(mutations.clientPortalCommentsRemove) | ||
); | ||
const { data = {} as any } = useQuery(gql(queries.clientPortalComments), { | ||
variables: { typeId, type }, | ||
fetchPolicy: 'network-only', | ||
notifyOnNetworkStatusChange: true | ||
}); | ||
|
||
const clientPortalComments = data ? data.clientPortalComments || [] : []; | ||
const [show, setShow] = useState(false); | ||
|
@@ -44,13 +38,13 @@ function Comment(item) { | |
</ColorButton> | ||
|
||
<Modal | ||
centered | ||
centered={true} | ||
show={show} | ||
onHide={handleClose} | ||
backdrop="static" | ||
keyboard={false} | ||
> | ||
<Modal.Header closeButton> | ||
<Modal.Header closeButton={true}> | ||
<Modal.Title>{__('Comments')}</Modal.Title> | ||
</Modal.Header> | ||
<Modal.Body> | ||
|
@@ -65,14 +59,20 @@ function Comment(item) { | |
<img | ||
src={readFile( | ||
createdUser && createdUser.avatar | ||
? createdUser?.avatar | ||
: '/static/avatar-colored.svg' | ||
? createdUser.avatar | ||
: '/images/avatar-colored.svg' | ||
)} | ||
alt="profile" | ||
/> | ||
<div> | ||
<CommentContent> | ||
<h5>{`${createdUser?.firstName} ${createdUser?.lastName}`}</h5> | ||
<h5> | ||
{createdUser | ||
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. create function util for these |
||
? createdUser.fullName || | ||
createdUser.username || | ||
createdUser.email | ||
: 'Undefined'} | ||
</h5> | ||
<div | ||
className="comment" | ||
dangerouslySetInnerHTML={{ | ||
|
@@ -85,7 +85,6 @@ function Comment(item) { | |
{dayjs(comment.createdAt).format('YYYY-MM-DD HH:mm')} | ||
</span> | ||
</div> | ||
<div className="actions"></div> | ||
</CreatedUser> | ||
</TicketComment> | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
const clientPortalCommentsRemove = ` | ||
mutation clientPortalCommentsRemove( | ||
$_id: String! | ||
const clientPortalCommentsAdd = ` | ||
mutation clientPortalCommentsAdd( | ||
$typeId: String! | ||
$type: String! | ||
$content: String! | ||
$userType: String! | ||
) { | ||
clientPortalCommentsRemove( | ||
_id: $_id | ||
) | ||
clientPortalCommentsAdd( | ||
typeId: $typeId | ||
type: $type | ||
content: $content | ||
userType: $userType | ||
) { | ||
_id | ||
} | ||
} | ||
`; | ||
|
||
export default { | ||
clientPortalCommentsRemove | ||
clientPortalCommentsAdd | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,17 +4,29 @@ import React from 'react'; | |
import { graphql } from '@apollo/client/react/hoc'; | ||
import Form from '../components/Form'; | ||
import { mutations } from '../graphql'; | ||
import { | ||
mutations as commentMutations, | ||
queries as commentQueries | ||
} from '@erxes/ui-cards/src/comment/graphql'; | ||
import { | ||
InternalNotesAddMutationResponse, | ||
InternalNotesAddMutationVariables | ||
InternalNotesAddMutationVariables, | ||
CommentAddMutationResponse, | ||
CommentAddMutationVariables, | ||
ClientPortalCommentQueryResponse | ||
} from '../types'; | ||
|
||
type Props = { | ||
contentType: string; | ||
contentTypeId: string; | ||
inputType?: string; | ||
}; | ||
|
||
type FinalProps = Props & InternalNotesAddMutationResponse; | ||
type FinalProps = { | ||
clientPortalCommentsQueries: ClientPortalCommentQueryResponse; | ||
} & Props & | ||
InternalNotesAddMutationResponse & | ||
CommentAddMutationResponse; | ||
|
||
class FormContainer extends React.Component< | ||
FinalProps, | ||
|
@@ -28,21 +40,44 @@ class FormContainer extends React.Component< | |
|
||
// create internalNote | ||
create = (variables, callback: () => void) => { | ||
const { contentType, contentTypeId, internalNotesAdd } = this.props; | ||
const { | ||
contentType, | ||
contentTypeId, | ||
internalNotesAdd, | ||
commentAdd, | ||
inputType, | ||
clientPortalCommentsQueries | ||
} = this.props; | ||
|
||
this.setState({ isLoading: true }); | ||
|
||
internalNotesAdd({ | ||
variables: { | ||
contentType, | ||
contentTypeId, | ||
...variables | ||
} | ||
}).then(() => { | ||
callback(); | ||
if (inputType === 'comment') { | ||
commentAdd({ | ||
variables: { | ||
type: contentType.slice(6), | ||
typeId: contentTypeId, | ||
userType: 'team', | ||
...variables | ||
} | ||
}).then(() => { | ||
clientPortalCommentsQueries.refetch(); | ||
callback(); | ||
|
||
this.setState({ isLoading: false }); | ||
}); | ||
} else { | ||
internalNotesAdd({ | ||
variables: { | ||
contentType, | ||
contentTypeId, | ||
...variables | ||
} | ||
}).then(() => { | ||
callback(); | ||
|
||
this.setState({ isLoading: false }); | ||
}); | ||
this.setState({ isLoading: false }); | ||
}); | ||
} | ||
}; | ||
|
||
render() { | ||
|
@@ -71,5 +106,22 @@ export default compose( | |
refetchQueries: ['activityLogs'] | ||
}; | ||
} | ||
}) | ||
}), | ||
graphql<Props>(gql(commentQueries.clientPortalComments), { | ||
name: 'clientPortalCommentsQueries', | ||
options: ({ contentType, contentTypeId }) => ({ | ||
variables: { type: contentType.slice(6), typeId: contentTypeId } | ||
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. Remove clientportal related code from internalnote |
||
}) | ||
}), | ||
graphql<Props, CommentAddMutationResponse, CommentAddMutationVariables>( | ||
gql(commentMutations.clientPortalCommentsAdd), | ||
{ | ||
name: 'commentAdd', | ||
options: () => { | ||
return { | ||
refetchQueries: ['activityLogs'] | ||
}; | ||
} | ||
} | ||
) | ||
)(FormContainer); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
why?