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
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
4647686
MI-1721: Added OAuth2.0 for confluence server and cloud (#2)
shivamjosh Jun 8, 2022
e9cb0f4
Reverted unnecessary Makefile changes
shivamjosh Jun 14, 2022
7674a87
fixing bugs
Jun 30, 2022
872fcc0
fixing merge conflicts
Jun 30, 2022
847e853
[MI-1897]:bug fix
Jun 30, 2022
e5f3894
[MI-1897]:fixed github workflow
Jun 30, 2022
4acd7f4
[MI-1897]:fixed review fixes
Kshitij-Katiyar Jul 4, 2022
ed4758a
[MI-1897]:fixed review fixes
Kshitij-Katiyar Jul 5, 2022
5ec8256
added checks for commands
Kshitij-Katiyar Jul 21, 2022
62d3cab
fixed test cases
Kshitij-Katiyar Jul 21, 2022
dbabb8b
Updated assets
Kshitij-Katiyar Jul 22, 2022
053b9d4
Updated userID to delete subscription
Kshitij-Katiyar Sep 28, 2022
27d75d2
[MI-2252]:Added Config manipulation through slash commands (List/Add)…
Kshitij-Katiyar Oct 31, 2022
1e6baaf
[MI-2324]:Fixed review fixes of confluence auth/notification PR (#10)
Kshitij-Katiyar Nov 4, 2022
5a7415b
Fixed merge conflicts
Kshitij-Katiyar Nov 4, 2022
2c17ae5
Updated markdown files for install commands
Kshitij-Katiyar Nov 10, 2022
9281ca2
[MI-2282]:Created /confluence migrate list command to list old subscr…
Kshitij-Katiyar Nov 14, 2022
3d4f6c0
[MI-2362]:Fixed review fixes of confluence PR 89 on mattermost (#13)
Kshitij-Katiyar Nov 18, 2022
e843a42
[MI-2366]:Fixed review fixes of confluence PR 88 on mattermost (#12)
Kshitij-Katiyar Nov 18, 2022
debb47f
deleted github workflow files
Kshitij-Katiyar Nov 18, 2022
54e7f03
[MI-2413]:Fixed merge conflicts and review comments on PR#89 (#14)
Kshitij-Katiyar Dec 2, 2022
b78e955
[MI-2449]:Fixed bugs found by QA (#15)
Kshitij-Katiyar Dec 22, 2022
789389f
Merge branch 'master' of github.com:mattermost/mattermost-plugin-conf…
ayusht2810 Feb 8, 2024
8650c09
Updated the readme to include the new features (#19)
ayusht2810 Feb 12, 2024
88e9fdc
Merge branch 'master' of github.com:mattermost/mattermost-plugin-conf…
raghavaggarwal2308 Feb 19, 2024
3312e4d
Removed unused files
raghavaggarwal2308 Feb 19, 2024
3c2e771
Fixed merge conflicts
Kshitij-Katiyar Apr 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# Continuous Integration Workflow to check pushes to master and pull requests:
Kshitij-Katiyar marked this conversation as resolved.
Show resolved Hide resolved
# - code style guidelines are followed (make check-style)
# - tests pass (make test)
# - code builds (make dist)
name: CI

on:
pull_request:
push:
branches:
- master

jobs:
ci:
name: Check style; build; test
runs-on: ubuntu-latest

steps:
- name: Set up Go v1.16.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x

- name: Set up Node.js v14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
registry-url: https://npm.pkg.github.com/

- name: Install golangci
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.36.0

- uses: actions/checkout@v2

- name: Cache go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-

- name: Install webapp dependencies
run: make webapp/node_modules
env:
TERM: dumb

- name: check style
run: make check-style
env:
TERM: dumb

- name: run tests
run: make test
env:
TERM: dumb

- name: build and bundle the plugin
id: build
run: |
make dist
echo ::set-output name=BUNDLE_NAME::$(cd dist; ls *.tar.gz)
env:
TERM: dumb

- name: Upload the built plugin as an artifact
uses: actions/upload-artifact@v2
with:
name: ${{ steps.build.outputs.BUNDLE_NAME }}
path: dist/${{ steps.build.outputs.BUNDLE_NAME }}
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
build_and_release:
name: Build and release
runs-on: ubuntu-latest
steps:
- name: Set up Go v1.16.x
uses: actions/setup-go@v2
with:
go-version: 1.16.x

- name: Set up Node.js v14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
registry-url: https://npm.pkg.github.com/

- uses: actions/checkout@v2

- name: Cache go modules
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build and bundle the plugin
id: build
run: |
make dist
echo ::set-output name=BUNDLE_NAME::$(cd dist; ls *.tar.gz)
env:
TERM: dumb

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/${{ steps.build.outputs.BUNDLE_NAME }}
asset_name: ${{ steps.build.outputs.BUNDLE_NAME }}
asset_content_type: application/gzip
5 changes: 3 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ linters:
- golint
- gosec
- gosimple
- govet
- ineffassign
- interfacer
Kshitij-Katiyar marked this conversation as resolved.
Show resolved Hide resolved
- misspell
- nakedret
- staticcheck
Expand All @@ -55,6 +53,9 @@ issues:
- path: server/configuration.go
linters:
- unused
- path: server/kv.go
linters:
- gosec
Kshitij-Katiyar marked this conversation as resolved.
Show resolved Hide resolved
- path: _test\.go
linters:
- bodyclose
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ ifneq ($(HAS_SERVER),)
echo "golangci-lint is not installed. Please see https://github.com/golangci/golangci-lint#install for installation instructions."; \
exit 1; \
fi; \

@echo Running golangci-lint
golangci-lint run ./...
endif
Expand All @@ -78,7 +77,7 @@ endif
## Ensures NPM dependencies are installed without having to run this all the time.
webapp/node_modules: webapp/package.json
ifneq ($(HAS_WEBAPP),)
cd webapp && $(NPM) install
cd webapp && $(NPM) install --verbose
touch $@
endif

Expand Down
12 changes: 12 additions & 0 deletions assets/templates/atlassian-connect.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@
{
"event": "page_updated",
"url": "/cloud/page_updated?secret={{ .SharedSecret }}"
},
{
"event": "space_created",
"url": "/cloud/space_created?secret={{ .SharedSecret }}"
},
{
"event": "space_updated",
"url": "/cloud/space_updated?secret={{ .SharedSecret }}"
},
{
"event": "space_removed",
"url": "/cloud/space_removed?secret={{ .SharedSecret }}"
}
]
}
Expand Down
22 changes: 22 additions & 0 deletions assets/templates/command/install_cloud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{ .ConfluenceURL }} has been successfully added. To finish the configuration, create a new app in your Confluence instance following these steps:

1. Go to the Atlassian [Developer Console](https://developer.atlassian.com/console/myapps/).
2. Select **Create > OAuth2.0 integration**.
3. Select **Authorization** in the left menu.
4. Next to OAuth 2.0 (3LO), select **Configure**.
5. In the **Callback URL** field enter:
``
{{ .RedirectURL }}
``.
6. Select **Permissions** in the left menu.
7. Add the **Confluence API**, and then select `Read user`, `Write Confluence content`, `Read Confluence content all`, and `Read Confluence detailed content` scopes, and select **Save**.
8. Copy the `clientID` and `clientSecret` from **Settings**, and paste them into the plugin configuration.
9. In Mattermost, use the "/confluence connect" slash command to connect your Mattermost account with your Confluence account.
To finish the configuration, add a new app in your Confluence Cloud instance by following these steps:
1. Go to **Settings > Apps > Manage Apps**.
2. Select **Settings** at the bottom of the page, enable development mode, and apply the change. Development mode allows you to install apps from outside of the Atlassian Marketplace.
3. Select **Upload App**.
4. In the **From this URL** field, enter: `{{ .CloudURL }}`.
5. Once installed, you'll see the "Installed and ready to go!" message.

If you see an option to create a Confluence issue, you're all set! If not, refer to our [documentation](https://mattermost.gitbook.io/plugin-confluence) for troubleshooting help.
17 changes: 17 additions & 0 deletions assets/templates/command/install_server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{ .ConfluenceURL }} has been successfully added. To finish the configuration, add an Application Link in your Confluence instance following these steps:

1. Go to [**Settings > Applications > Application
Links**]({{ .ConfluenceURL }}/plugins/servlet/applinks/listApplicationLinks)
2. Select **Create link**.
3. On the **Create Link** screen, select **External Application** and **Incoming** as
`Application type` and `Direction` respectively. Select **Continue**.
4. On the **Link Applications** screen, set the following values:
**Name**: `Mattermost`
**Redirect URL**: ```{{ .RedirectURL }}```.
**Application Permissions**: `Admin`
Select **Continue**
5. Copy the `clientID` and `clientSecret` and paste them into the plugin configuration.
6. In Mattermost, use the "/confluence connect" slash command to connect your Mattermost account with your
Confluence account.

If you see an option to create a Confluence issue, you're all set! If not, refer to our [documentation](https://mattermost.gitbook.io/plugin-confluence) for troubleshooting help.
73 changes: 73 additions & 0 deletions assets/templates/oauth2/complete.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="en">
<head>
<style>
body {
color: rgb(23, 43, 77);
letter-spacing: -0.01em;
}

.flex-parent {
padding: 50px;
}

.btn {
-webkit-transition: all 0.15s ease;
-webkit-transition-delay: 0s;
-moz-transition: all 0.15s ease;
-o-transition: all 0.15s ease;
transition: all 0.15s ease false;
padding-right: 1em;
padding-left: 1em;
font-size: inherit;
border: none;
height: 2.4em;
border-radius: 4px;
cursor: pointer;
}

.btn-primary {
color: rgb(255, 255, 255);
background: rgb(0, 82, 204);
}

.btn-primary:hover,
.btn-primary:active {
background: rgb(0, 101, 255);
}

.btn-link {
color: #505f79;
background: #f4f5f7;
}

.btn-link:hover,
.btn-link:active {
background: #ebecf0;
}

.accounts-container {
padding: 1.6em 0 0.8em;
opacity: .6;
}
.icon--check {
margin-right: 4px;
}
</style>
<link rel="stylesheet" href="https://unpkg.com/@atlaskit/[email protected]/dist/bundle.css" media="all">
</head>
<body>
<div class="flex-parent">
<h3>
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="15" class="icon--check" viewBox="0 0 18 14">
<path fill="#0052CC" d="M100.649576,76.1740942 C100.649576,76.4531124 100.537969,76.7321306 100.337075,76.9330237 L90.7388497,86.5312494 C90.5379566,86.7321425 90.2589384,86.8437498 89.9799202,86.8437498 C89.700902,86.8437498 89.4218838,86.7321425 89.2209908,86.5312494 L83.6629484,80.9732071 C83.4620553,80.772314 83.350448,80.4932958 83.350448,80.2142776 C83.350448,79.9352594 83.4620553,79.6562412 83.6629484,79.4553481 L85.1808074,77.9374892 C85.3817005,77.7365961 85.6607186,77.6249888 85.9397368,77.6249888 C86.218755,77.6249888 86.4977732,77.7365961 86.6986663,77.9374892 L89.9799202,81.2299038 L97.3013575,73.8973058 C97.5022506,73.6964127 97.7812688,73.5848054 98.060287,73.5848054 C98.3393052,73.5848054 98.6183234,73.6964127 98.8192165,73.8973058 L100.337075,75.4151648 C100.537969,75.6160579 100.649576,75.895076 100.649576,76.1740942 Z" transform="translate(-83 -73)"/>
</svg>
Mattermost user is now connected to Confluence
</h3>
<div class="accounts-container">
<div>Mattermost account: {{ .MattermostDisplayName }}</div>
<div>Confluence account: {{ .ConfluenceDisplayName }}</div>
</div>
</div>
</body>
</html>
31 changes: 31 additions & 0 deletions assets/templates/other/message.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<style>
body {
color: rgb(23, 43, 77);
letter-spacing: -0.01em;
}

.flex-parent {
padding: 50px;
}

.message-container {
padding: 1.6em 0 0.8em;
opacity: .6;
}
</style>
<link rel="stylesheet" href="https://unpkg.com/@atlaskit/[email protected]/dist/bundle.css" media="all">
</head>
<body>
<div class="flex-parent">
<h3>
{{ .Header}}
</h3>
<div class="message-container">
<div>{{ .Message }}</div>
</div>
</div>
</body>
</html>
Loading