forked from mattermost/mattermost-plugin-jira
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Review fixes of #872 #7
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
af819fa
[MI-2088]:Add Support for DM subscriptions for watchers and reporters
Nityanand13 9f2c461
[MI-2088]: Review Fixes
Nityanand13 0e1219e
[MI-2088]:Revieww fixes
Nityanand13 4a9c195
[MI-2088]: Review fixes done
Nityanand13 cecaaaa
[MI-2088]:fixed review fixes
Kshitij-Katiyar 47d4196
[MI-2088]:fixed review fixes
Kshitij-Katiyar 7c5d1a9
[MI-2088]:fixed review fixes
Kshitij-Katiyar b752323
[MI-2088]:Review fixes done
Nityanand13 5add692
Merge branch 'mm-507' of github.com:Brightscout/mattermost-plugin-jir…
Nityanand13 f6f0a2c
[MI-2088]: Review fixes done
Nityanand13 5e3ff1d
[MI-2088]: Review fixes done
Nityanand13 1ae8fe0
Resolved merge conflicts
Nityanand13 d93fa60
[MI-2088]: Review fixes done
Nityanand13 9cd26d5
[MI-2088]: Review fixes done
Nityanand13 2acc22c
[MI-2088]: Review fixes done
Nityanand13 2df6112
[MI-2088]: Fixes CI errors
Nityanand13 03e76ba
[MI-2088]: Review fixes done
Nityanand13 50637bd
[MI-2088]: Review fixes done
Nityanand13 842c34e
[MI-2088]: Review fixes done
Nityanand13 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 |
---|---|---|
|
@@ -1133,13 +1133,38 @@ func (p *Plugin) GetUserSetting(wh *webhook, instanceID types.ID, jiraAccountID, | |
|
||
func (s *ConnectionSettings) ShouldReceiveNotification(role string) bool { | ||
if val, ok := s.RolesForDMNotification[role]; ok { | ||
return *val | ||
return val | ||
} | ||
|
||
// Check old setting for backwards compatibility | ||
return s.Notifications | ||
} | ||
|
||
func (p *Plugin) fetchConnectedUserFromAccount(account map[string]string, instance Instance) (Client, *Connection, error) { | ||
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. Why is this needed? 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. @javaguirre because this was one of your review comments |
||
var mattermostUserID types.ID | ||
var err error | ||
if account["AccountID"] != "" { | ||
mattermostUserID, err = p.userStore.LoadMattermostUserID(instance.GetID(), account["AccountID"]) | ||
} else { | ||
mattermostUserID, err = p.userStore.LoadMattermostUserID(instance.GetID(), account["Name"]) | ||
} | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
|
||
connection, err := p.userStore.LoadConnection(instance.GetID(), mattermostUserID) | ||
if err != nil { | ||
return nil, nil, err | ||
} | ||
|
||
client, err := instance.GetClient(connection) | ||
if err != nil { | ||
return nil, connection, err | ||
} | ||
Nityanand13 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
return client, connection, nil | ||
} | ||
|
||
func (wh *webhook) fetchConnectedUser(p *Plugin, instanceID types.ID) (Client, *Connection, error) { | ||
var accountInformation []map[string]string | ||
|
||
|
@@ -1169,22 +1194,7 @@ func (wh *webhook) fetchConnectedUser(p *Plugin, instanceID types.ID) (Client, * | |
return nil, nil, err | ||
} | ||
for _, account := range accountInformation { | ||
var mattermostUserID types.ID | ||
if account["AccountID"] != "" { | ||
mattermostUserID, err = p.userStore.LoadMattermostUserID(instance.GetID(), account["AccountID"]) | ||
} else { | ||
mattermostUserID, err = p.userStore.LoadMattermostUserID(instance.GetID(), account["Name"]) | ||
} | ||
if err != nil { | ||
continue | ||
} | ||
|
||
connection, err := p.userStore.LoadConnection(instance.GetID(), mattermostUserID) | ||
if err != nil { | ||
continue | ||
} | ||
|
||
client, err := instance.GetClient(connection) | ||
client, connection, err := p.fetchConnectedUserFromAccount(account, instance) | ||
if err != nil { | ||
continue | ||
} | ||
|
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 it was nil before and now it's not? It doesn't seem like a needed change, but I might be wrong.
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.
@javaguirre because the function
LogError
andLogDebug
does not have a return type.