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-32- Fix issue with agenda list numbering #44

Merged
merged 5 commits into from
Jun 25, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
2 changes: 1 addition & 1 deletion build/deploy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os"
"path/filepath"

"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mholt/archiver/v3"
"github.com/pkg/errors"
)
Expand Down
2 changes: 1 addition & 1 deletion build/manifest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"io/ioutil"
"os"

"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/pkg/errors"
)

Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.12

require (
github.com/blang/semver v3.6.1+incompatible // indirect
github.com/mattermost/mattermost-server v1.4.1-0.20191016162522-6597fdb40134 // Mattermost Server 5.16.0
github.com/mattermost/mattermost-server/v5 v5.3.2-0.20200612222822-6422b19d606b
github.com/mholt/archiver/v3 v3.3.0
github.com/pkg/errors v0.8.1
github.com/stretchr/testify v1.3.0
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.5.1
)
526 changes: 433 additions & 93 deletions go.sum

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions server/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (

"github.com/pkg/errors"

"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/plugin"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/plugin"
)

const (
Expand Down Expand Up @@ -152,16 +152,19 @@ func (p *Plugin) executeCommandQueue(args *model.CommandArgs) *model.CommandResp
return responsef("Error calculating hashtags")
}

itemsQueued, appErr := p.API.SearchPostsInTeam(args.TeamId, []*model.SearchParams{{Terms: hashtag, IsHashtag: true}})
searchResults, appErr := p.API.SearchPostsInTeamForUser(args.TeamId, args.UserId, &model.SearchParameter{Terms: &hashtag})

if appErr != nil {
return responsef("Error getting user")
return responsef("Error calculating list number")
}

postList := *searchResults.PostList
numQueueItems := len(postList.Posts)

_, appErr = p.API.CreatePost(&model.Post{
UserId: args.UserId,
ChannelId: args.ChannelId,
Message: fmt.Sprintf("#### %v %v) %v", hashtag, len(itemsQueued)+1, message),
Message: fmt.Sprintf("#### %v %v) %v", hashtag, numQueueItems+1, message),
})
if appErr != nil {
return responsef("Error creating post: " + appErr.Message)
Expand Down
2 changes: 1 addition & 1 deletion server/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"github.com/mattermost/mattermost-server/plugin"
"github.com/mattermost/mattermost-server/v5/plugin"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (

"github.com/pkg/errors"

"github.com/mattermost/mattermost-server/model"
"github.com/mattermost/mattermost-server/plugin"
"github.com/mattermost/mattermost-server/v5/model"
"github.com/mattermost/mattermost-server/v5/plugin"
)

// Plugin implements the interface expected by the Mattermost server to communicate between the server and plugin processes.
Expand Down
2 changes: 1 addition & 1 deletion server/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"testing"
"time"

"github.com/mattermost/mattermost-server/plugin/plugintest"
"github.com/mattermost/mattermost-server/v5/plugin/plugintest"
"github.com/stretchr/testify/assert"
)

Expand Down