-
Notifications
You must be signed in to change notification settings - Fork 1
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
now able to remove user feedback after given #183
base: main
Are you sure you want to change the base?
Changes from all commits
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,4 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,34 +30,36 @@ export const UserFeedbackActions: React.FC<IUserFeedbackProps> = ({ messageId, w | |
const classes = useClasses(); | ||
|
||
const { instance, inProgress } = useMsal(); | ||
|
||
const dispatch = useAppDispatch(); | ||
const { selectedId } = useAppSelector((state: RootState) => state.conversations); | ||
|
||
const onUserFeedbackProvided = useCallback( | ||
async (positive: boolean) => { | ||
const chatService = new ChatService(); | ||
const userRating = positive ? UserFeedback.Positive : UserFeedback.Negative; | ||
const currentFeedback = positive ? UserFeedback.Positive : UserFeedback.Negative; | ||
|
||
// Determine if we're toggling the current selection off | ||
const newFeedback = wasHelpful === currentFeedback ? undefined : currentFeedback; | ||
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. Would we prefer setting this to 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. whatever gets decided here can cascade into each of my comments |
||
const token = await AuthHelper.getSKaaSAccessToken(instance, inProgress); | ||
|
||
chatService | ||
.rateMessageAync(selectedId, messageId, positive, token) | ||
.rateMessageAync(selectedId, messageId, newFeedback === UserFeedback.Positive, token) | ||
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. issue: 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. on testing I see that the frontend does update to allow you to remove a "like" or "dislike" but, the payload going to the backend is still either |
||
.then(() => { | ||
dispatch( | ||
updateMessageProperty({ | ||
chatId: selectedId, | ||
messageIdOrIndex: messageId, | ||
property: 'userFeedback', | ||
value: userRating, | ||
value: newFeedback, | ||
frontLoad: true, | ||
}), | ||
}) | ||
); | ||
}) | ||
.catch((e) => { | ||
console.error(e); | ||
}); | ||
}, | ||
[instance, inProgress, selectedId, messageId, dispatch], | ||
[instance, inProgress, selectedId, messageId, wasHelpful, dispatch] | ||
); | ||
|
||
return ( | ||
|
@@ -66,7 +68,7 @@ export const UserFeedbackActions: React.FC<IUserFeedbackProps> = ({ messageId, w | |
<Button | ||
icon={wasHelpful === UserFeedback.Positive ? <ThumbLike20Filled /> : <ThumbLike20Regular />} | ||
appearance="transparent" | ||
aria-label="Edit" | ||
aria-label="Like" | ||
onClick={() => { | ||
void onUserFeedbackProvided(true); | ||
}} | ||
|
@@ -76,7 +78,7 @@ export const UserFeedbackActions: React.FC<IUserFeedbackProps> = ({ messageId, w | |
<Button | ||
icon={wasHelpful === UserFeedback.Negative ? <ThumbDislike20Filled /> : <ThumbDislike20Regular />} | ||
appearance="transparent" | ||
aria-label="Edit" | ||
aria-label="Dislike" | ||
onClick={() => { | ||
void onUserFeedbackProvided(false); | ||
}} | ||
|
@@ -85,3 +87,4 @@ export const UserFeedbackActions: React.FC<IUserFeedbackProps> = ({ messageId, w | |
</div> | ||
); | ||
}; | ||
|
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.
polish: should remove this from the PR. Don't think we need a
yarn.lock
in our scripts directory