Skip to content

Commit 73085d8

Browse files
nevyangelovaNevyana Angelova
andauthored
Update server and webapp dependencies to latest Mattermost SDK (#197)
* Update server and webapp dependencies to latest Mattermost SDK * update babel/eslint-parser * Fix coderabbit feedback * Sync manifest files and remove community-supported references * coderabbit review --------- Co-authored-by: Nevyana Angelova <nevyangelova@Nevy-Macbook-16-2025.local>
1 parent d929cdb commit 73085d8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+8335
-34739
lines changed

README.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
![CI](https://github.com/gabrieljackson/mattermost-plugin-wrangler/actions/workflows/ci.yaml/badge.svg) [![Go Report Card](https://goreportcard.com/badge/github.com/gabrieljackson/mattermost-plugin-wrangler)](https://goreportcard.com/report/github.com/gabrieljackson/mattermost-plugin-wrangler)
66

7-
A community supported [Mattermost](https://mattermost.com) [plugin](https://developers.mattermost.com/integrate/plugins) for managing messages.
7+
A [Mattermost](https://mattermost.com) [plugin](https://developers.mattermost.com/integrate/plugins) for managing messages.
88

99
## About
1010

@@ -137,8 +137,3 @@ Q: Is there a way to undo the message action I just took?
137137

138138
A: No. If you moved a thread then moving it back should be simple enough, but there is no way to directly undo the actions that Wrangler takes.
139139

140-
---
141-
142-
Q: What does it mean for a plugin to be community supported?
143-
144-
A: Wrangler is one of many plugins that is available to be deployed to a Mattermost instance, but is not directly maintained by Mattermost. Instead, community contributions are accepted for fixes and new features.

build/deploy/main.go

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33
package main
44

55
import (
6+
"context"
67
"fmt"
78
"log"
89
"os"
910
"path/filepath"
1011

11-
"github.com/mattermost/mattermost-server/v5/model"
12+
"github.com/mattermost/mattermost/server/public/model"
1213
"github.com/mholt/archiver/v3"
1314
"github.com/pkg/errors"
1415
)
@@ -24,7 +25,6 @@ func main() {
2425
}
2526
}
2627

27-
// deploy handles deployment of the plugin to a development server.
2828
func deploy() error {
2929
if len(os.Args) < 3 {
3030
return errors.New("invalid number of arguments")
@@ -52,9 +52,9 @@ func deploy() error {
5252
if adminUsername != "" && adminPassword != "" {
5353
client := model.NewAPIv4Client(siteURL)
5454
log.Printf("Authenticating as %s against %s.", adminUsername, siteURL)
55-
_, resp := client.Login(adminUsername, adminPassword)
56-
if resp.Error != nil {
57-
return errors.Wrapf(resp.Error, "failed to login as %s", adminUsername)
55+
_, _, err := client.Login(context.Background(), adminUsername, adminPassword)
56+
if err != nil {
57+
return errors.Wrapf(err, "failed to login as %s", adminUsername)
5858
}
5959

6060
return uploadPlugin(client, pluginID, bundlePath)
@@ -73,8 +73,6 @@ func deploy() error {
7373
return copyPlugin(pluginID, copyTargetDirectory, bundlePath)
7474
}
7575

76-
// uploadPlugin attempts to upload and enable a plugin via the Client4 API.
77-
// It will fail if plugin uploads are disabled.
7876
func uploadPlugin(client *model.Client4, pluginID, bundlePath string) error {
7977
pluginBundle, err := os.Open(bundlePath)
8078
if err != nil {
@@ -83,22 +81,20 @@ func uploadPlugin(client *model.Client4, pluginID, bundlePath string) error {
8381
defer pluginBundle.Close()
8482

8583
log.Print("Uploading plugin via API.")
86-
_, resp := client.UploadPluginForced(pluginBundle)
87-
if resp.Error != nil {
88-
return fmt.Errorf("Failed to upload plugin bundle: %s", resp.Error.Error())
84+
_, _, err = client.UploadPluginForced(context.Background(), pluginBundle)
85+
if err != nil {
86+
return fmt.Errorf("failed to upload plugin bundle: %w", err)
8987
}
9088

9189
log.Print("Enabling plugin.")
92-
_, resp = client.EnablePlugin(pluginID)
93-
if resp.Error != nil {
94-
return fmt.Errorf("Failed to enable plugin: %s", resp.Error.Error())
90+
_, err = client.EnablePlugin(context.Background(), pluginID)
91+
if err != nil {
92+
return fmt.Errorf("failed to enable plugin: %w", err)
9593
}
9694

9795
return nil
9896
}
9997

100-
// copyPlugin attempts to install a plugin by copying it to a sibling ../mattermost-server/plugin
101-
// directory. A server restart is required before the plugin will start.
10298
func copyPlugin(pluginID, targetPath, bundlePath string) error {
10399
targetPath = filepath.Join(targetPath, "plugins")
104100

build/manifest/main.go

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ package main
33
import (
44
"encoding/json"
55
"fmt"
6-
"io/ioutil"
76
"os"
87

9-
"github.com/mattermost/mattermost-server/v5/model"
8+
"github.com/mattermost/mattermost/server/public/model"
109
"github.com/pkg/errors"
1110
)
1211

@@ -15,9 +14,9 @@ const pluginIDGoFileTemplate = `// This file is automatically generated. Do not
1514
package main
1615
1716
import (
18-
"strings"
17+
"encoding/json"
1918
20-
"github.com/mattermost/mattermost-server/v5/model"
19+
"github.com/mattermost/mattermost/server/public/model"
2120
)
2221
2322
var manifest *model.Manifest
@@ -27,7 +26,10 @@ const manifestStr = ` + "`" + `
2726
` + "`" + `
2827
2928
func init() {
30-
manifest = model.ManifestFromJson(strings.NewReader(manifestStr))
29+
manifest = new(model.Manifest)
30+
if err := json.Unmarshal([]byte(manifestStr), manifest); err != nil {
31+
panic("failed to unmarshal manifest: " + err.Error())
32+
}
3133
}
3234
`
3335

@@ -91,8 +93,6 @@ func findManifest() (*model.Manifest, error) {
9193
}
9294
defer manifestFile.Close()
9395

94-
// Re-decode the manifest, disallowing unknown fields. When we write the manifest back out,
95-
// we don't want to accidentally clobber anything we won't preserve.
9696
var manifest model.Manifest
9797
decoder := json.NewDecoder(manifestFile)
9898
decoder.DisallowUnknownFields()
@@ -103,28 +103,23 @@ func findManifest() (*model.Manifest, error) {
103103
return &manifest, nil
104104
}
105105

106-
// dumpPluginId writes the plugin id from the given manifest to standard out
107106
func dumpPluginID(manifest *model.Manifest) {
108107
fmt.Printf("%s", manifest.Id)
109108
}
110109

111-
// dumpPluginVersion writes the plugin version from the given manifest to standard out
112110
func dumpPluginVersion(manifest *model.Manifest) {
113111
fmt.Printf("%s", manifest.Version)
114112
}
115113

116-
// applyManifest propagates the plugin_id into the server and webapp folders, as necessary
117114
func applyManifest(manifest *model.Manifest) error {
118115
if manifest.HasServer() {
119-
// generate JSON representation of Manifest.
120116
manifestBytes, err := json.MarshalIndent(manifest, "", " ")
121117
if err != nil {
122118
return err
123119
}
124120
manifestStr := string(manifestBytes)
125121

126-
// write generated code to file by using Go file template.
127-
if err := ioutil.WriteFile(
122+
if err := os.WriteFile(
128123
"server/manifest.go",
129124
[]byte(fmt.Sprintf(pluginIDGoFileTemplate, manifestStr)),
130125
0644,
@@ -134,17 +129,13 @@ func applyManifest(manifest *model.Manifest) error {
134129
}
135130

136131
if manifest.HasWebapp() {
137-
// generate JSON representation of Manifest.
138-
// JSON is very similar and compatible with JS's object literals. so, what we do here
139-
// is actually JS code generation.
140132
manifestBytes, err := json.MarshalIndent(manifest, "", " ")
141133
if err != nil {
142134
return err
143135
}
144136
manifestStr := string(manifestBytes)
145137

146-
// write generated code to file by using JS file template.
147-
if err := ioutil.WriteFile(
138+
if err := os.WriteFile(
148139
"webapp/src/manifest.ts",
149140
[]byte(fmt.Sprintf(pluginIDJSFileTemplate, manifestStr)),
150141
0644,

go.mod

Lines changed: 49 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,72 @@
1-
module github.com/gabrieljackson/mattermost-plugin-wrangler
1+
module github.com/mattermost/mattermost-plugin-wrangler
22

3-
go 1.22
4-
5-
toolchain go1.22.9
3+
go 1.24.6
64

75
require (
8-
github.com/mattermost/mattermost-server/v5 v5.39.3
6+
github.com/mattermost/mattermost/server/public v0.1.12
97
github.com/mholt/archiver/v3 v3.5.1
108
github.com/pkg/errors v0.9.1
119
github.com/spf13/pflag v1.0.5
12-
github.com/stretchr/testify v1.9.0
10+
github.com/stretchr/testify v1.10.0
1311
)
1412

1513
require (
16-
github.com/andybalholm/brotli v1.0.3 // indirect
17-
github.com/blang/semver v3.5.1+incompatible // indirect
18-
github.com/davecgh/go-spew v1.1.1 // indirect
14+
filippo.io/edwards25519 v1.1.0 // indirect
15+
github.com/andybalholm/brotli v1.0.1 // indirect
16+
github.com/beevik/etree v1.1.0 // indirect
17+
github.com/blang/semver/v4 v4.0.0 // indirect
18+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
1919
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
20-
github.com/dustin/go-humanize v1.0.0 // indirect
21-
github.com/dyatlov/go-opengraph v0.0.0-20210112100619-dae8665a5b09 // indirect
22-
github.com/fatih/color v1.12.0 // indirect
20+
github.com/dyatlov/go-opengraph/opengraph v0.0.0-20220524092352-606d7b1e5f8a // indirect
21+
github.com/fatih/color v1.18.0 // indirect
2322
github.com/francoispqt/gojay v1.2.13 // indirect
24-
github.com/go-asn1-ber/asn1-ber v1.5.3 // indirect
25-
github.com/go-sql-driver/mysql v1.6.0 // indirect
26-
github.com/golang/protobuf v1.5.2 // indirect
27-
github.com/golang/snappy v0.0.3 // indirect
28-
github.com/google/uuid v1.2.0 // indirect
29-
github.com/gorilla/websocket v1.4.2 // indirect
23+
github.com/go-asn1-ber/asn1-ber v1.5.7 // indirect
24+
github.com/go-sql-driver/mysql v1.8.1 // indirect
25+
github.com/golang/protobuf v1.5.4 // indirect
26+
github.com/golang/snappy v0.0.2 // indirect
27+
github.com/google/uuid v1.6.0 // indirect
28+
github.com/gorilla/websocket v1.5.3 // indirect
3029
github.com/hashicorp/errwrap v1.1.0 // indirect
31-
github.com/hashicorp/go-hclog v0.16.1 // indirect
30+
github.com/hashicorp/go-hclog v1.6.3 // indirect
3231
github.com/hashicorp/go-multierror v1.1.1 // indirect
33-
github.com/hashicorp/go-plugin v1.4.2 // indirect
34-
github.com/hashicorp/yamux v0.0.0-20210316155119-a95892c5f864 // indirect
35-
github.com/json-iterator/go v1.1.11 // indirect
36-
github.com/klauspost/compress v1.13.1 // indirect
37-
github.com/klauspost/cpuid/v2 v2.0.6 // indirect
32+
github.com/hashicorp/go-plugin v1.6.3 // indirect
33+
github.com/hashicorp/yamux v0.1.2 // indirect
34+
github.com/jonboulle/clockwork v0.2.2 // indirect
35+
github.com/klauspost/compress v1.11.4 // indirect
3836
github.com/klauspost/pgzip v1.2.5 // indirect
39-
github.com/lib/pq v1.10.2 // indirect
40-
github.com/mattermost/go-i18n v1.11.0 // indirect
41-
github.com/mattermost/ldap v0.0.0-20201202150706-ee0e6284187d // indirect
42-
github.com/mattermost/logr v1.0.13 // indirect
43-
github.com/mattn/go-colorable v0.1.8 // indirect
44-
github.com/mattn/go-isatty v0.0.13 // indirect
45-
github.com/minio/md5-simd v1.1.2 // indirect
46-
github.com/minio/minio-go/v7 v7.0.11 // indirect
47-
github.com/minio/sha256-simd v1.0.0 // indirect
48-
github.com/mitchellh/go-homedir v1.1.0 // indirect
49-
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
50-
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
51-
github.com/modern-go/reflect2 v1.0.1 // indirect
37+
github.com/lib/pq v1.10.9 // indirect
38+
github.com/mattermost/go-i18n v1.11.1-0.20211013152124-5c415071e404 // indirect
39+
github.com/mattermost/gosaml2 v0.8.0 // indirect
40+
github.com/mattermost/ldap v0.0.0-20231116144001-0f480c025956 // indirect
41+
github.com/mattermost/logr/v2 v2.0.22 // indirect
42+
github.com/mattermost/xml-roundtrip-validator v0.1.0 // indirect
43+
github.com/mattn/go-colorable v0.1.14 // indirect
44+
github.com/mattn/go-isatty v0.0.20 // indirect
5245
github.com/nwaples/rardecode v1.1.0 // indirect
5346
github.com/oklog/run v1.1.0 // indirect
5447
github.com/pborman/uuid v1.2.1 // indirect
55-
github.com/pelletier/go-toml v1.9.3 // indirect
56-
github.com/philhofer/fwd v1.1.1 // indirect
57-
github.com/pierrec/lz4/v4 v4.1.8 // indirect
58-
github.com/pmezard/go-difflib v1.0.0 // indirect
59-
github.com/rs/xid v1.3.0 // indirect
60-
github.com/sirupsen/logrus v1.8.1 // indirect
48+
github.com/pelletier/go-toml v1.9.5 // indirect
49+
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect
50+
github.com/pierrec/lz4/v4 v4.1.2 // indirect
51+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
52+
github.com/russellhaering/goxmldsig v1.2.0 // indirect
6153
github.com/stretchr/objx v0.5.2 // indirect
62-
github.com/tinylib/msgp v1.1.6 // indirect
63-
github.com/ulikunitz/xz v0.5.10 // indirect
64-
github.com/wiggin77/cfg v1.0.2 // indirect
65-
github.com/wiggin77/merror v1.0.3 // indirect
54+
github.com/tinylib/msgp v1.2.5 // indirect
55+
github.com/ulikunitz/xz v0.5.9 // indirect
56+
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
57+
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
58+
github.com/wiggin77/merror v1.0.5 // indirect
6659
github.com/wiggin77/srslog v1.0.1 // indirect
6760
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
68-
github.com/yuin/goldmark v1.3.8 // indirect
69-
go.uber.org/atomic v1.8.0 // indirect
70-
go.uber.org/multierr v1.7.0 // indirect
71-
go.uber.org/zap v1.17.0 // indirect
72-
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect
73-
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
74-
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
75-
golang.org/x/text v0.3.6 // indirect
76-
google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84 // indirect
77-
google.golang.org/grpc v1.38.0 // indirect
78-
google.golang.org/protobuf v1.26.0 // indirect
79-
gopkg.in/ini.v1 v1.62.0 // indirect
80-
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
61+
golang.org/x/crypto v0.37.0 // indirect
62+
golang.org/x/mod v0.22.0 // indirect
63+
golang.org/x/net v0.39.0 // indirect
64+
golang.org/x/sys v0.32.0 // indirect
65+
golang.org/x/text v0.24.0 // indirect
66+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250124145028-65684f501c47 // indirect
67+
google.golang.org/grpc v1.70.0 // indirect
68+
google.golang.org/protobuf v1.36.4 // indirect
69+
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
8170
gopkg.in/yaml.v2 v2.4.0 // indirect
8271
gopkg.in/yaml.v3 v3.0.1 // indirect
8372
)

0 commit comments

Comments
 (0)