Skip to content
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-85,84,71,49] Confluence Phase-2 (Authorisation/Notifications) #89

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

Kshitij-Katiyar
Copy link

@Kshitij-Katiyar Kshitij-Katiyar commented Jul 22, 2022

Summary and Features Added:-

  1. Removed the dependency on the Confluence-side plugin (OBR file) to support Confluence Server/Data Center subscriptions.

  2. Added support for OAuth 2.0 for both Cloud and Server editions of Confluence. Users can OAuth using /Confluence connect command.

  3. Remove the need to use a single shared authentication token limiting subscriptions to
    admins only.

  4. In the case of subscriptions, users can only subscribe to spaces and pages that their Confluence
    account has access to, and the same for the events as well. Due to this, we had to change the way we were storing the subscription, and because of that the subscriptions were not backward compatible.
    To tackle that we have added some commands to migrate the subscriptions and those commands can only be seen in the help command and auto-suggestion where there are some older subscriptions are present.

  5. Support of the following events is there:-
    • space_updated
    • page_created
    • page_restored
    • page_trashed
    • page_updated
    • comment_created
    • comment_updated

  6. Added permissions for both Mattermost and confluence side which Mattermost Admin can change in Plugin configuration.

shivamjosh and others added 11 commits July 21, 2022 14:25
* MI-1721: WIP

* MI-1721: WIP

* MI-1721: Fixed GetClient function

* MI-1721: WIP

* [MI-1751]:Added Logic to create webhook for connecting to confluence server

* MI-1721: Added OAuth2.0 for confluence server and cloud

* MI-1721: Done some code refactoring

* [MI-1772]:WIP:Working on Notifications

* [MI-1751]:Fixed Review fixes

* [MI-1751]:[WIP]:Added Notifications for server

* [MI-1772]:[WIP]:refactoring code

* [MI-1772]:Fixed Self Review fixes

* [MI-1772]:Fixed Review fixes

* [MI-1794][WIP]:Added Notifications for Confluence Cloud

* [MI-1794]:Added Confluence Cloud Notification

* [MI-1794]:Self review fixes

* [MI-1788]:Completed Notifications for Confluence Server

* [MI-1788]:Self Review Fixes

* [MI-1811]:Fixed Unsubscribe command

* [MI-1811]:Self review fixes

* [MI-1814]:Added /edit Command in confluence Plugin

* [MI-1794]:Fixed Review fixes

* [MI-1822][WIP]:wrote some test cases

* [MI-1826]:Added Permissions for who can create/edit/delete the subscriptions

* [MI-1826]:Fixed review fixes

* [MI-1788]:Fixed Review fixes

* [MI-1811]:Fixed review fixes

* [MI-1788]:Removed Kv store Admin Funtions

* [MI-1814]:Fixed review fixes

* [MI-1822]:Updated the test cases

* [MI-1834][WIP]:Fixing bugs

* [MI-1834]:self review fixes

* [MI-1834]:review fixes done

* [MI-1826]:review fixes done

* [MI-1814]:review fixes done

* [MI-1811]:review fixes done

* [MI-1842]:Added test cases for Oauth flow

* [MI-1842]:self review fixes

* [MI-1842]:added yml files

* [MI-1721]:fixed review fixes

* [MI-1849]:fixed bug fixes

* [MI-1849]:fixed templates

* [MI-1849]:fixed review fixes

* [MI-1853]:fixed linting errors

* [MI-1853]:Fixed and removed lint erros

* [MI-1853]:self review fixes

* [MI-1853]:fixed linters in github actions

* [MI-1853]:fixes goimports error

* [MI-1853]:fix lint errors in webapp

* [MI-1853]:fixed webapp test cases

* [MI-1853]:Fixed circleCI error

* [MI-1853]:fixed Circle lint error

* [MI-1853]:Ran go mod tidy

* [MI-1853]:fixed go.mod file

* [MI-1853]:fixed go.mod and go.sum

* [MI-1853]:fixed review fixes

* [MI-1721]:fixed review fixes

* [MI-1751]:Added Logic to create webhook for connecting to confluence server (#1)

* [MI-1751]:Added Logic to create webhook for connecting to confluence server

* [MI-1751]:Fixed Review fixes

* [MI-1772]:Added logic for server side notifications for confluence (#3)

* [MI-1772]:WIP:Working on Notifications

* [MI-1751]:[WIP]:Added Notifications for server

* [MI-1772]:[WIP]:refactoring code

* [MI-1772]:Fixed Self Review fixes

* [MI-1772]:Fixed Review fixes

* [MI-1772]:fixed review fixes

* [MI-1794]:Added Notifications for Confluence Cloud (#4)

* [MI-1794][WIP]:Added Notifications for Confluence Cloud

* [MI-1794]:Added Confluence Cloud Notification

* [MI-1794]:Self review fixes

* [MI-1794]:Fixed Review fixes

* [MI-1794]:fixed review fixes

* [MI-1794]:fixed review fixes

* [MI-1788]:Created Notifications for Confluence Server(webhook per user) (#5)

* [MI-1788]:Completed Notifications for Confluence Server

* [MI-1788]:Self Review Fixes

* [MI-1788]:Fixed Review fixes

* [MI-1788]:Removed Kv store Admin Funtions

* [MI-1811]:Added Logic for Unsubscribe Command  (#6)

* [MI-1811]:Fixed Unsubscribe command

* [MI-1811]:Self review fixes

* [MI-1811]:Fixed review fixes

* [MI-1811]:review fixes done

* [MI-1814]:Added /edit Command in confluence Plugin (#7)

* [MI-1814]:Added /edit Command in confluence Plugin

* [MI-1814]:Fixed review fixes

* [MI-1814]:review fixes done

* [MI-1814]:fixed review fixes

* [MI-1822]:Updated the Test cases for Confluence Plugin (#9)

* [MI-1822][WIP]:wrote some test cases

* [MI-1822]:Updated the test cases

* [MI-1822]:fixed review fixes

* [MI-1822]:fixed review fixes

Co-authored-by: Kshitij Katiyar <[email protected]>

Co-authored-by: Kshitij Katiyar <[email protected]>

Co-authored-by: Kshitij Katiyar <[email protected]>

Co-authored-by: Kshitij Katiyar <[email protected]>

Co-authored-by: Kshitij Katiyar <[email protected]>

Co-authored-by: Kshitij Katiyar <[email protected]>

Co-authored-by: Kshitij Katiyar <[email protected]>
Co-authored-by: Shivam Chauhan <[email protected]>

* [MI-1721]:fixed circle error

* [MI-1721]:fixed frontend linters

Co-authored-by: Kshitij Katiyar <[email protected]>
Co-authored-by: kshitij katiyar <[email protected]>
Copy link
Contributor

@mickmister mickmister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @Kshitij-Katiyar 👍

I've reviewed quite a bit of the code and still have about half the files to review. I've left some comments on what I've reviewed so far. Please let me know your thoughts.

.github/workflows/ci.yml Outdated Show resolved Hide resolved
.golangci.yml Outdated Show resolved Hide resolved
.golangci.yml Outdated Show resolved Hide resolved
package-lock.json Outdated Show resolved Hide resolved
@@ -41,6 +41,28 @@ export const editChannelSubscription = (body) => {
};
};

export function getConnected() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems weird to put this in this file but there's no "general" actions file so I suppose this makes sense. I wonder if we'll be adding other actions files in the future though

Copy link
Author

@Kshitij-Katiyar Kshitij-Katiyar Nov 3, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I create a new general file or is this fine?

ByURLPagID map[string]StringArrayMap
ByURLSpaceKey map[string]StringArrayMap
ByURLPageID map[string]StringStringArrayMap
ByURLSpaceKey map[string]StringStringArrayMap
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed data type here too. Is this backwards compatible?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mickmister no it is not but i am working on a feature to migrate the older subscriptions to the newer version of confluence

server/serializer/confluence_cloud.go Outdated Show resolved Hide resolved
server/serializer/confluence_cloud.go Outdated Show resolved Hide resolved
server/serializer/confluence_server.go Outdated Show resolved Hide resolved
server/serializer/confluence_server.go Outdated Show resolved Hide resolved
@mickmister
Copy link
Contributor

mickmister commented Sep 6, 2022

My main concern is saving the configuration for each Confluence server in the config. I'm thinking this should instead be in the KV store and be configured with slash commands or a new Flow, rather than adding a custom setting for the admin console.

There are a lot of benefits to this, including being able to configure these things with the Mattermost mobile app.

@catalintomai catalintomai requested review from javaguirre and removed request for catalintomai October 14, 2022 16:11
@javaguirre
Copy link

In case of the command.go file, it's better if you start changes and you move it so Git gets that it was the same file, I haven't checked the commits, but for some reason I think the file was deleted in a commit and then added in another, so we can't see the diff there. I have used a online diff tool to see better those changes.

https://www.diffchecker.com/wNVsBTgB

@javaguirre
Copy link

javaguirre commented Oct 17, 2022

I don't understand well the difference between this PR and #88 . I think there is a very big commit in common, so I'd need to review the same code twice, which is a bit inefficient, Could this PR have the #88 as base so we don't have the same changes in both? Or how were these PRs split into two?

Thank you! :-)

@Kshitij-Katiyar
Copy link
Author

Kshitij-Katiyar commented Oct 17, 2022

I don't understand well the difference between this PR and #88 . I think there is a very big commit in common, so I'd need to review the same code twice, which is a bit inefficient, Could this PR have the #88 as base so we don't have the same changes in both? Or how were these PRs split into two?

Thank you! :-)

@javaguirre PR 88 contains the code of this PR and 1 additional feature of creating a confluence page using mattermost. Actually, it was a concern of @mickmister that it would be better to break the PR 88 into 2 different PRs so I did exactly that. One of the broken-up PR is this PR 89 and I was not able to create the PR for the second feature due to the fact that 2nd feature also requires the code of this PR and I can't make incremental PRs on mattermost. Please ping freely in case of any query
Thank you! :-)

@javaguirre
Copy link

If you put PR #88 as a base for PR #89?

To be honest, I don't think we can effectively review this PR nor the #88 , It's too long and we can't really test even a good percentage of the features.

Next time would be nice having different PRs for different issues, having another PR as base different from master, but PRs longer than 500/750 LOC are almost impossible to review effectively.

I'd say we either accept this PR as is or close it, but I don't find a way of reviewing all these changes. I'll accept it, but next time I suggest creating smaller PRs that are related between them or trying to make independent changes thinking before about how to split the work.

Thank you!

server/client_server.go Outdated Show resolved Hide resolved
server/edit_subscription.go Show resolved Hide resolved
server/utils/utils.go Outdated Show resolved Hide resolved
…#1) (#6)

* [MI-2252]:Added Config manipulation through slash commands

* [MI-2252]:Fixed review fixes

* [MI-2252]:Fixed review fixes

* [MI-2252]:fixed review fixes

* [MI-2252]:Fixed refresh token bug

* [MI-2261]:Created delete sub command for confluence config (#2)

* [MI-2261]:Created delete sub command for confluence config

* [MI-2261]:Fixed lint errors

* [MI-2261]:fixed review fixes

* [MI-2261]:Fixed review fixes

* [MI-2261]:Fixed review fixes

* [MI-2267]:Wrote test cases for adding configs through slash commands (#3)

* [MI-2267]:Wrote test cases for adding confligs through slash commands

* [MI-2267]:Added default url for config modal

* [MI-2267]:Fixed review fixes

* [MI-2267]:Fixed review fixes

* [MI-2267]:Fixed self review fixes

* [MI-2267]:Fixed review fixes

* [MI-2267]:fixed review fixes

* [MI-2267]:fixed review fixes

* [MI-2267]:Fixed review fixes

* [MI-2280]:Add Dynamic Argument for config add command (#4)

* [MI-2280]:Add Dynamic Argument for config add command

* [MI-2280]:Fixed review fixes

* [MI-2280]:Fixed CI error

* [MI-2280]:Fixed CI errors

* [MI-2280]:Fixed CI lint errors

* [MI-2280]:Fixed test cases

* [MI-2280]:fixed CI error

* [MI-2280]:fixed review fixes
@Kshitij-Katiyar
Copy link
Author

@mickmister Added the feature for config manipulation through slash commands and not using the custom component

@hanzei hanzei mentioned this pull request Nov 14, 2022
@Kshitij-Katiyar
Copy link
Author

@mickmister Added feature to migrate old confluence subscriptions to this newer version

Copy link

@javaguirre javaguirre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't want to block this and Michael has much more context, but now that I have time I'd like to discuss some changes/improvements that won't take much time.

Thank you!

server/serializer/channel_subscription.go Show resolved Hide resolved
server/serializer/channel_subscription.go Show resolved Hide resolved
server/serializer/confluence_config.go Show resolved Hide resolved
server/serializer/page_subscription.go Show resolved Hide resolved
server/test_utils.go Outdated Show resolved Hide resolved
server/utils/utils.go Show resolved Hide resolved
* [MI-2362]:Fixed review fixes of confluence PR 89 on mattermost

* [MI-2362]:Fixed review fixes
* [MI-2366]:Fixed review fixes of confluence PR 88 on mattermost

* [MI-2366]:Fixed CI error

* [MI-2366]:Fixed review fixes

* [MI-2366]:Fixed review fixes
@Kshitij-Katiyar Kshitij-Katiyar requested review from javaguirre and removed request for mickmister November 18, 2022 12:04
@Kshitij-Katiyar
Copy link
Author

@javaguirre I Fixed review comments from PR 88 and 89 and I have pushed 2 separate commits for review comments for different branches.

@javaguirre
Copy link

@javaguirre I Fixed review comments from PR 88 and 89 and I have pushed 2 separate commits for review comments for different branches.

Thank you for the effort! I'll review it right away! 💯

Copy link

@javaguirre javaguirre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see anything else for now, but I'll review it again next week.

server/kv.go Outdated Show resolved Hide resolved
server/kv.go Show resolved Hide resolved
server/kv.go Outdated Show resolved Hide resolved
server/kv.go Outdated Show resolved Hide resolved
* bump version to 1.3.0 (mattermost-community#97)

* [MI-2413]:Fixed review comments given by mm team

* [MI-2413]:Fixed merge conflicts

* [MI-2413]:Fixed lint errors

* [MI-2413]:Fixed go critic error

* [MI-2413]:Fixed manifest.go error

* [MI-2413]:Fixed review fixes

* [MI-2413]:Fixed review fixes

* [MI-2413]:fixed build error

Co-authored-by: Michael Kochell <[email protected]>
Copy link

@javaguirre javaguirre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't want to block this more than necessary.

This PR needs special attention regarding QA, especially for backward compatibility issues, and support after releasing a new version of the plugin.

@Kshitij-Katiyar
Copy link
Author

I don't want to block this more than necessary.

This PR needs special attention regarding QA, especially for backward compatibility issues, and support after releasing a new version of the plugin.

@javaguirre Sure let me know if you need anything

* [MI-2449]:Fixed bugs found by QA

* [MI-2449]:Fixed lint error

* [MI-2449]:Fixed layout of autosuggest in commands

* [MI-2449]:Fixed review fixes

* [MI-2449]:Fixed test cases

* [MI-2449]:Fixed lint errors

* [MI-2449]:Added proper error

* [MI-2449]:Fixed connect command error

* [MI-2449]:Trim the url in the interactive dialogue

* [MI-2449]:Fixed review fixes

* [MI-2483]:Fixed the URL error in config modal (#17)

* [MI-2483]:Fixed the URL error in config modal

* [MI-2483]:Fixed review fixes

* [MI-2483]:Fixed lint errors

* [MI-2449]
@hanzei hanzei removed the request for review from mickmister May 30, 2023 19:10
@raghavaggarwal2308
Copy link

raghavaggarwal2308 commented Jan 22, 2024

@mickmister Do we need to add this PR & PR #88 in an upcoming release?

@mickmister mickmister self-requested a review January 22, 2024 16:21
@mickmister
Copy link
Contributor

@raghavaggarwal2308 Sounds good to me 👍

ayusht2810 and others added 2 commits February 8, 2024 17:13
* Updated the readme

* fixed review comments

* Fixed lint errors
@raghavaggarwal2308
Copy link

@mickmister Gentle reminder to re-review this PR

@raghavaggarwal2308
Copy link

@mickmister Gentle reminder to re-review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants