-
Notifications
You must be signed in to change notification settings - Fork 132
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
[GH-626]: Supported filtering on comment visibility for subscriptions #894
Open
Nityanand13
wants to merge
14
commits into
mattermost:master
Choose a base branch
from
Brightscout:mm-626
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4802fb0
[MI-2337]: Supported filtering on comment visibility for subscription…
Nityanand13 444352c
Done the review fixes of PR #894 (#21)
Nityanand13 1064968
[MI 2337] Fixed CI errors and review comments of PR #894 (#24)
Nityanand13 2edf22e
[MM-626]:Fixed merge conflicts
Kshitij-Katiyar 649d520
[MM-626]:Fixed a endpoint
Kshitij-Katiyar ff40054
Merge branch 'master' of github.com:mattermost/mattermost-plugin-jira…
raghavaggarwal2308 279ed3d
Fixed:
raghavaggarwal2308 8929dfe
Review fixes
raghavaggarwal2308 1d1b82a
Review fixes
raghavaggarwal2308 8fbe0e9
Merge branch 'master' of github.com:mattermost/mattermost-plugin-jira…
raghavaggarwal2308 70efc7e
[MM-537] Review fixes:
raghavaggarwal2308 5e21750
[MM-537] Fix lint error
raghavaggarwal2308 1095514
Merge branch 'master' of github.com:mattermost/mattermost-plugin-jira…
raghavaggarwal2308 2b316c6
Merge branch 'master' of github.com:mattermost/mattermost-plugin-jira…
Kshitij-Katiyar 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
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
13 changes: 13 additions & 0 deletions
13
webapp/src/components/data_selectors/jira_commentvisibility_selector/index.ts
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import {connect} from 'react-redux'; | ||
import {bindActionCreators} from 'redux'; | ||
|
||
import {searchCommentVisibilityFields} from 'actions'; | ||
|
||
import JiraCommentVisibilitySelector from './jira_commentvisibility_selector'; | ||
|
||
const mapDispatchToProps = (dispatch) => bindActionCreators({searchCommentVisibilityFields}, dispatch); | ||
|
||
export default connect(null, mapDispatchToProps)(JiraCommentVisibilitySelector); |
53 changes: 53 additions & 0 deletions
53
...onents/data_selectors/jira_commentvisibility_selector/jira_commentvisibility_selector.tsx
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. | ||
// See LICENSE.txt for license information. | ||
|
||
import React from 'react'; | ||
|
||
import {ReactSelectOption} from 'types/model'; | ||
|
||
import BackendSelector, {Props as BackendSelectorProps} from '../backend_selector'; | ||
|
||
const stripHTML = (text: string) => { | ||
if (!text) { | ||
return text; | ||
} | ||
|
||
const doc = new DOMParser().parseFromString(text, 'text/html'); | ||
return doc.body.textContent || ''; | ||
}; | ||
|
||
type Props = BackendSelectorProps & { | ||
searchCommentVisibilityFields: (params: {fieldValue: string}) => ( | ||
Promise<{data: {groups: {items: {name: string}[]}}; error?: Error}> | ||
); | ||
fieldName: string; | ||
}; | ||
|
||
const JiraCommentVisibilitySelector = (props: Props) => { | ||
const {value, isMulti, instanceID, searchCommentVisibilityFields} = props; | ||
|
||
const commentVisibilityFields = async (inputValue: string): Promise<ReactSelectOption[]> => { | ||
const params = { | ||
fieldValue: inputValue, | ||
instance_id: instanceID, | ||
}; | ||
return searchCommentVisibilityFields(params).then(({data}) => { | ||
return data.groups.items.map((suggestion) => ({ | ||
value: suggestion.name, | ||
label: stripHTML(suggestion.name), | ||
})); | ||
}); | ||
}; | ||
|
||
const fetchInitialSelectedValues = async (): Promise<ReactSelectOption[]> => (value?.length ? commentVisibilityFields('') : []); | ||
|
||
return ( | ||
<BackendSelector | ||
{...props} | ||
fetchInitialSelectedValues={fetchInitialSelectedValues} | ||
search={commentVisibilityFields} | ||
/> | ||
); | ||
}; | ||
|
||
export default JiraCommentVisibilitySelector; |
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
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.
I'm thinking we want to use project roles for this
I have a WIP here that implements the data fetching piece, but not the comment filtering piece master...comment-security
mattermost-plugin-jira/server/autocomplete_search.go
Lines 108 to 121 in a86928d
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.
@mickmister We are getting the user
groups
here. I don't think the project roles API returns that response