Skip to content

Commit

Permalink
Release 2.0.1 (#226)
Browse files Browse the repository at this point in the history
* react-dom_webpack-external (#224)

* bump version 2.0.1

* MM-40214: Add App Bar icon (#214)

* go get -u golang.org/x/sys

* Fix CI

* Add App Bar icon

* Fix errors found by linter

* Allow arrow functions in eslint's func-style rule

* fix type mismatch at redux Provider

Co-authored-by: Ngoan Tran <[email protected]>

* go mod tidy

* remove npm i --verbose

* Fix linter errors (#227)

* lint

Co-authored-by: Alejandro García Montoro <[email protected]>
Co-authored-by: Ngoan Tran <[email protected]>
Co-authored-by: Ben Schumacher <[email protected]>
  • Loading branch information
4 people authored Nov 3, 2022
1 parent d56ea37 commit 63d4c61
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 115 deletions.
10 changes: 3 additions & 7 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,35 @@ linters-settings:
simplify: true
goimports:
local-prefixes: github.com/mattermost/mattermost-plugin-jitsi
golint:
min-confidence: 0
govet:
check-shadowing: true
enable-all: true
disable:
- fieldalignment
misspell:
locale: US

linters:
disable-all: true
enable:
- bodyclose
- deadcode
- errcheck
- goconst
- gocritic
- gofmt
- goimports
- golint
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- misspell
- nakedret
- revive
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unused
- varcheck
- whitespace

issues:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ifneq ($(wildcard $(ASSETS_DIR)/.),)
cp -r $(ASSETS_DIR) dist/$(PLUGIN_ID)/
endif
ifneq ($(HAS_PUBLIC),)
cp -r public/ dist/$(PLUGIN_ID)/
cp -r public/ dist/$(PLUGIN_ID)/public/
endif
ifneq ($(HAS_SERVER),)
mkdir -p dist/$(PLUGIN_ID)/server/dist;
Expand Down
13 changes: 2 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,7 @@ require (
github.com/nicksnyder/go-i18n/v2 v2.0.3
github.com/pelletier/go-toml v1.8.0 // indirect
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.6.0
go.uber.org/zap v1.15.0 // indirect
golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 // indirect
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
golang.org/x/net v0.0.0-20200528225125-3c3fba18258b // indirect
golang.org/x/sys v0.0.0-20200523222454-059865788121 // indirect
github.com/stretchr/testify v1.6.1
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
golang.org/x/text v0.3.2
golang.org/x/tools v0.0.0-20200528185414-6be401e3f76e // indirect
google.golang.org/genproto v0.0.0-20200528191852-705c0b31589b // indirect
google.golang.org/grpc v1.29.1 // indirect
gopkg.in/yaml.v3 v3.0.0-20200506231410-2ff61e1afc86 // indirect
honnef.co/go/tools v0.0.1-2020.1.4 // indirect
)
79 changes: 6 additions & 73 deletions go.sum

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "Jitsi audio and video conferencing plugin for Mattermost.",
"homepage_url": "https://github.com/mattermost/mattermost-plugin-jitsi",
"support_url": "https://github.com/mattermost/mattermost-plugin-jitsi/issues",
"release_notes_url": "https://github.com/mattermost/mattermost-plugin-jitsi/releases/tag/v2.0.0",
"release_notes_url": "https://github.com/mattermost/mattermost-plugin-jitsi/releases/tag/v2.0.1",
"icon_path": "assets/icon.svg",
"version": "2.0.0",
"version": "2.0.1",
"min_server_version": "5.2.0",
"server": {
"executables": {
Expand Down
Binary file added public/app-bar-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions server/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (p *Plugin) executeHelpCommand(c *plugin.Context, args *model.CommandArgs)
},
})

text := helpTitle + strings.Replace(commandHelp, "|", "`", -1)
text := helpTitle + strings.ReplaceAll(commandHelp, "|", "`")
post := &model.Post{
UserId: p.botID,
ChannelId: args.ChannelId,
Expand Down Expand Up @@ -171,7 +171,7 @@ func (p *Plugin) executeSettingsCommand(c *plugin.Context, args *model.CommandAr
post := &model.Post{
UserId: p.botID,
ChannelId: args.ChannelId,
Message: strings.Replace(text, "|", "`", -1),
Message: strings.ReplaceAll(text, "|", "`"),
}
_ = p.API.SendEphemeralPost(args.UserId, post)

Expand Down
4 changes: 2 additions & 2 deletions server/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestCommandHelp(t *testing.T) {
require.Nil(t, err)
p.i18nBundle = i18nBundle

helpText := strings.Replace(`###### Mattermost Jitsi Plugin - Slash Command help
helpText := strings.ReplaceAll(`###### Mattermost Jitsi Plugin - Slash Command help
* |/jitsi| - Create a new meeting
* |/jitsi [topic]| - Create a new meeting with specified topic
* |/jitsi help| - Show this help text
Expand All @@ -43,7 +43,7 @@ func TestCommandHelp(t *testing.T) {
* |words|: Random English words in title case (e.g. PlayfulDragonsObserveCuriously)
* |uuid|: UUID (universally unique identifier)
* |mattermost|: Mattermost specific names. Combination of team name, channel name and random text in public and private channels; personal meeting name in direct and group messages channels.
* |ask|: The plugin asks you to select the name every time you start a meeting`, "|", "`", -1)
* |ask|: The plugin asks you to select the name every time you start a meeting`, "|", "`")

apiMock.On("SendEphemeralPost", "test-user", &model.Post{
UserId: "test-bot-id",
Expand Down
4 changes: 2 additions & 2 deletions server/manifest.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (p *Plugin) OnActivate() error {

botID, ensureBotError := p.Helpers.EnsureBot(jitsiBot, options...)
if ensureBotError != nil {
return errors.Wrap(ensureBotError, "failed to ensure jitsi bot user.")
return errors.Wrap(ensureBotError, "failed to ensure jitsi bot user")
}

p.botID = botID
Expand Down Expand Up @@ -356,7 +356,7 @@ func (c Claims) MarshalBinary() (data []byte, err error) {

func encodeJitsiMeetingID(meeting string) string {
reg := regexp.MustCompile("[^a-zA-Z0-9-_]+")
meeting = strings.Replace(meeting, " ", "-", -1)
meeting = strings.ReplaceAll(meeting, " ", "-")
return reg.ReplaceAllString(meeting, "")
}

Expand Down
2 changes: 1 addition & 1 deletion webapp/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"func-call-spacing": [2, "never"],
"func-name-matching": 0,
"func-names": 2,
"func-style": [2, "declaration"],
"func-style": [2, "declaration", {"allowArrowFunctions": true}],
"generator-star-spacing": [2, {"before": false, "after": true}],
"global-require": 2,
"guard-for-in": 2,
Expand Down
12 changes: 10 additions & 2 deletions webapp/src/components/root_portal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ type Props = {
children: React.ReactNode,
}

export class InjectionProvider extends React.Component<any> {
public render(): JSX.Element {
const stores = {...this.props};
delete stores.children;
return React.createElement(Provider as any, stores, this.props.children);
}
}

export default class RootPortal {
el: HTMLElement;
store: any;
Expand All @@ -38,11 +46,11 @@ export default class RootPortal {
const rootPortal = document.getElementById('root-portal');
if (rootPortal) {
ReactDOM.render((
<Provider store={this.store}>
<InjectionProvider store={this.store}>
<I18nProvider>
<Conference/>
</I18nProvider>
</Provider>
</InjectionProvider>
), this.el);
}
}
Expand Down
28 changes: 20 additions & 8 deletions webapp/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as React from 'react';

import {Channel} from 'mattermost-redux/types/channels';
import {Post} from 'mattermost-redux/types/posts';
import {getConfig} from 'mattermost-redux/selectors/entities/general';

import Icon from './components/icon';
import PostTypeJitsi from './components/post_type_jitsi';
Expand Down Expand Up @@ -36,14 +37,25 @@ class PluginClass {
document.head.appendChild(script);
}
registry.registerReducer(reducer);
registry.registerChannelHeaderButtonAction(
<Icon/>,
(channel: Channel) => {
store.dispatch(startMeeting(channel.id));
},
'Start Jitsi Meeting'
);
registry.registerPostTypeComponent('custom_jitsi', (props: {post: Post}) => (<I18nProvider><PostTypeJitsi post={props.post}/></I18nProvider>));

const action = (channel: Channel) => {
store.dispatch(startMeeting(channel.id));
};
const helpText = 'Start Jitsi Meeting';

// Channel header icon
registry.registerChannelHeaderButtonAction(<Icon/>, action, helpText);

// App Bar icon
if (registry.registerAppBarComponent) {
const config = getConfig(store.getState());
const siteUrl = (config && config.SiteURL) || '';
const iconURL = `${siteUrl}/plugins/${pluginId}/public/app-bar-icon.png`;
registry.registerAppBarComponent(iconURL, action, helpText);
}

registry.registerPostTypeComponent('custom_jitsi', (props: { post: Post }) => (
<I18nProvider><PostTypeJitsi post={props.post}/></I18nProvider>));
registry.registerWebSocketEventHandler('custom_jitsi_config_update', () => store.dispatch(loadConfig()));
store.dispatch(loadConfig());
}
Expand Down
4 changes: 2 additions & 2 deletions webapp/src/manifest.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions webapp/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module.exports = {
},
externals: {
react: 'React',
'react-dom': 'ReactDOM',
redux: 'Redux',
'react-redux': 'ReactRedux',
'prop-types': 'PropTypes',
Expand Down

0 comments on commit 63d4c61

Please sign in to comment.