-
Notifications
You must be signed in to change notification settings - Fork 36
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
DOP-3903: API Changelog Support to omit entries #919
Merged
Merged
Changes from 14 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
cd1b530
DOP-3938 functional
anabellabuckvar 73184b4
Merge branch 'master' into DOP-3903-b
anabellabuckvar 00dedcb
DOP-3903-b cleaning up
anabellabuckvar 6f8af87
DOP-3903-b hidefromchangelog frontend diff
anabellabuckvar 6f341b2
DOP-3903-b tested changes
anabellabuckvar 3d90d72
DOP-3903-b deleted comments
anabellabuckvar 7ef99b6
DOP-3903-b boolean and object copies refactoring
anabellabuckvar 7bac35e
DOP-3903-b stylistic changes
anabellabuckvar fe20fc9
DOP-3903-b remove extra ternary ops
anabellabuckvar 201ee3d
Merge branch 'master' into DOP-3903-b
anabellabuckvar 340bb23
DOP-3903-b cleaned up merge
anabellabuckvar 5932cd2
DOP-3903-b unit tests added
anabellabuckvar 811ce88
DOP-3903-b unit tests
anabellabuckvar c2ceae3
Merge branch 'master' into DOP-3903-b
anabellabuckvar a92ad25
DOP-3903-b refactored hidechange functions
anabellabuckvar 44e3090
DOP-3903-b redid tests
anabellabuckvar d0d54d5
Merge branch 'master' into DOP-3903-b
anabellabuckvar 9ebb673
DOP-3903-b moved function calls
anabellabuckvar 2f8a825
DOP-3903-b removing, adding comments
anabellabuckvar f9a48f2
Merge branch 'master' into DOP-3903-b
anabellabuckvar d5ad525
Merge branch 'master' into DOP-3903-b
anabellabuckvar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,20 @@ import { fetchOADiff } from '../../../utils/realm'; | |
import useChangelogData from '../../../utils/use-changelog-data'; | ||
import { getDiffRequestFormat } from './getDiffRequestFormat'; | ||
|
||
//nested filtering of Diff changes with hideFromChangelog | ||
const hideDiffChanges = (diffData) => { | ||
const pathUpdate = (path) => { | ||
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. Logic looks like it's the same from the filtering of the changelog in |
||
const updatedPath = { ...path }; | ||
if (path?.changes) { | ||
updatedPath.changes = path.changes.filter((change) => !change.hideFromChangelog); | ||
} | ||
return updatedPath; | ||
}; | ||
|
||
const updatedDiffData = diffData.map(pathUpdate); | ||
return updatedDiffData.filter((path) => path.changes?.length); | ||
}; | ||
|
||
export const useFetchDiff = (resourceVersionOne, resourceVersionTwo, setIsLoading, setToastOpen, snootyEnv) => { | ||
const { index = {}, mostRecentDiff = {} } = useChangelogData(); | ||
const [diff, setDiff] = useState([]); | ||
|
@@ -20,7 +34,8 @@ export const useFetchDiff = (resourceVersionOne, resourceVersionTwo, setIsLoadin | |
setIsLoading(true); | ||
fetchOADiff(index.runId, fromAndToDiffLabel, snootyEnv) | ||
.then((response) => { | ||
setDiff(response); | ||
const filteredDiff = hideDiffChanges(response); | ||
setDiff(filteredDiff); | ||
setIsLoading(false); | ||
}) | ||
.catch((err) => { | ||
|
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
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.
Oh, and reminder to have this function somewhere where it can be exported so we can reuse it rather than declaring it twice!
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.
Refactored the functions, let me know what you think!