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] (WIP)Confluence Phase-2 #88

Draft
wants to merge 54 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
b1fc40e
MI-1721: Added OAuth2.0 for confluence server and cloud (#2)
shivamjosh Jun 8, 2022
d0ea009
Reverted unnecessary Makefile changes
shivamjosh Jun 14, 2022
7342638
Added missing EOF
shivamjosh Jun 14, 2022
87c2f90
[MI-1861]:Created Confluence Page for Both server and cloud
Jun 17, 2022
2da630d
bug fixes
Jun 17, 2022
07238a2
bug fixes
Jun 17, 2022
b2302f8
[MI-1861]:self review fixes
Jun 17, 2022
3ff12cd
[MI-1875]:Wrote snapshot testing
Jun 20, 2022
c742fad
[MI-1861]:fixed review fixes
Jun 21, 2022
f78d02f
[MI-1861]:fixed lint errors
Jun 21, 2022
07af2f7
[MI-1861]:fixed package.json
Jun 21, 2022
49e28d7
[MI-1875]:updated package-lock.json
Jun 21, 2022
d08708d
[MI-1875]:removed non working events
Jun 22, 2022
8c8d7b9
[MI-1861]:review fixes
Jun 22, 2022
f7f80ee
[MI-1861]:review fixes fixed
Jun 23, 2022
959a0fc
[MI-1861]:fixed lint errors
Jun 23, 2022
89ef770
create page module
Jun 23, 2022
8af5ce0
[MI-1888]:converted js to ts
Jun 27, 2022
d4e9cbb
[MI-1888]:fixed self review fixes
Jun 28, 2022
d980667
[MI-1888]:self review fixes
Jun 28, 2022
e99c600
[MI-1875]:Convert jsx tests to tsx
Kshitij-Katiyar Jun 29, 2022
df51265
[MI-1897]:fixed bugs given by QA
Jun 30, 2022
cef14c6
[MI-1888]:fixed self review fixes
Jun 30, 2022
1c1e2d0
[MI-1897]:fixed review fixes
Jun 30, 2022
bb2f49d
[MI-1897]:bug fix
Jun 30, 2022
d556fd3
[MI-1897]:fixed github workflow
Jun 30, 2022
8857174
[MI-1901] Bug fixes
ayusht2810 Jul 1, 2022
2b54b6e
[MI-1901] Fix testcases
ayusht2810 Jul 1, 2022
88675b9
[MI-1897]:fixed review fixes
Kshitij-Katiyar Jul 4, 2022
5e70827
[MI-1897]:fixed review fixes
Kshitij-Katiyar Jul 5, 2022
65307b0
[MI-1888] Review fixes
ayusht2810 Jul 5, 2022
f1b20f9
Merge branch 'MI-1888' of https://github.com/Brightscout/mattermost-p…
ayusht2810 Jul 5, 2022
acb5ebe
[MI-1901]:Fix new type errros
ayusht2810 Jul 5, 2022
ca80718
[MI-1888] Review fixes #2
ayusht2810 Jul 6, 2022
269b4b5
[MI-1888] Self review fix
ayusht2810 Jul 6, 2022
81666ab
[MI-1901] Remove eslint disable rule
ayusht2810 Jul 6, 2022
fc484a3
[MI-1901] Review fixes
ayusht2810 Jul 7, 2022
37f4171
[MI-1888] Update handleClose function
ayusht2810 Jul 7, 2022
c1e8570
[MI-1888] Review fixes #3
ayusht2810 Jul 7, 2022
cd3302d
[MI-1901] Review fixes #2
ayusht2810 Jul 7, 2022
25d49e9
Pull from parent branch
ayusht2810 Jul 7, 2022
ea8b6b6
Review fixes #3
ayusht2810 Jul 8, 2022
6998a61
Review fixes 4
ayusht2810 Jul 8, 2022
c05d5a1
Merge pull request #16 from Brightscout/MI-1888
Kshitij-Katiyar Jul 8, 2022
adfdbc9
[MI-1875]:fixed merge conflicts
Kshitij-Katiyar Jul 8, 2022
03f950b
Merge pull request #15 from Brightscout/MI-1875
Kshitij-Katiyar Jul 8, 2022
35222a2
Merge pull request #17 from Brightscout/MI-1897
Kshitij-Katiyar Jul 8, 2022
90383ab
Merge pull request #18 from Brightscout/MI-1901
Kshitij-Katiyar Jul 8, 2022
cbbc721
bug fixes
Kshitij-Katiyar Jul 8, 2022
83b00c9
Bug fixes
ayusht2810 Jul 8, 2022
8fb1931
Fix fmt error
ayusht2810 Jul 8, 2022
357f219
Applied feedback suggestions by cwarnermm
Kshitij-Katiyar Jul 19, 2022
17228d8
Updated assests for commands
Kshitij-Katiyar Jul 19, 2022
0dc9170
updated assets
Kshitij-Katiyar Jul 20, 2022
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:
# - 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
- misspell
- nakedret
- staticcheck
Expand All @@ -55,6 +53,9 @@ issues:
- path: server/configuration.go
linters:
- unused
- path: server/kv.go
linters:
- gosec
- path: _test\.go
linters:
- bodyclose
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,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 Expand Up @@ -124,7 +124,7 @@ dist: apply server webapp bundle
## Builds and installs the plugin to a server.
.PHONY: deploy
deploy: dist
./build/bin/pluginctl deploy $(PLUGIN_ID) dist/$(BUNDLE_NAME)
./build/bin/deploy deploy $(PLUGIN_ID) dist/$(BUNDLE_NAME)

## Builds and installs the plugin to a server, updating the webapp automatically when changed.
.PHONY: watch
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/).
Kshitij-Katiyar marked this conversation as resolved.
Show resolved Hide resolved
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:
Kshitij-Katiyar marked this conversation as resolved.
Show resolved Hide resolved
**Name**: `Mattermost`
Kshitij-Katiyar marked this conversation as resolved.
Show resolved Hide resolved
**Redirect URL**: ```{{ .RedirectURL }}```.
**Application Permissions**: `Admin`
Select **Continue**
Kshitij-Katiyar marked this conversation as resolved.
Show resolved Hide resolved
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