mirror of
https://github.com/hanzoai/team.git
synced 2026-09-30 01:57:35 +00:00
The server module named github.com/hanzoai/team/server/v8 — a path that resolves to the retired workspace's repository, not this one — while server/public still published github.com/mattermost/mattermost/server/public. Both are github.com/hanzoteam/server/... now, which is where this code actually lives. That second half is what made the binary unbootable. Upstream's public path stayed claimed by upstream, mattermost-plugin-ai imported it, and the build linked public/model twice; public/plugin's gob.Register then ran twice under one name and panicked at init, before main. Reverting the rename traded the brand for a working binary. Rebranding the plugin alongside it needs no such trade: the agents fork is github.com/hanzoteam/agents/v2 against our public module, so no module named mattermost/mattermost is in the graph at all. Measured: `go list -deps ./cmd/mattermost` names exactly one public/model, and it is ours.
55 lines
1.3 KiB
Go
55 lines
1.3 KiB
Go
package pluginapi
|
|
|
|
import (
|
|
"bytes"
|
|
"io"
|
|
|
|
"github.com/hanzoteam/server/server/public/model"
|
|
"github.com/hanzoteam/server/server/public/plugin"
|
|
)
|
|
|
|
// EmojiService exposes methods to manipulate emojis.
|
|
type EmojiService struct {
|
|
api plugin.API
|
|
}
|
|
|
|
// Get gets a custom emoji by id.
|
|
//
|
|
// Minimum server version: 5.6
|
|
func (e *EmojiService) Get(id string) (*model.Emoji, error) {
|
|
emoji, appErr := e.api.GetEmoji(id)
|
|
|
|
return emoji, normalizeAppErr(appErr)
|
|
}
|
|
|
|
// GetByName gets a custom emoji by its name.
|
|
//
|
|
// Minimum server version: 5.6
|
|
func (e *EmojiService) GetByName(name string) (*model.Emoji, error) {
|
|
emoji, appErr := e.api.GetEmojiByName(name)
|
|
|
|
return emoji, normalizeAppErr(appErr)
|
|
}
|
|
|
|
// GetImage gets a custom emoji's content and format by id.
|
|
//
|
|
// Minimum server version: 5.6
|
|
func (e *EmojiService) GetImage(id string) (io.Reader, string, error) {
|
|
contentBytes, format, appErr := e.api.GetEmojiImage(id)
|
|
if appErr != nil {
|
|
return nil, "", normalizeAppErr(appErr)
|
|
}
|
|
|
|
return bytes.NewReader(contentBytes), format, nil
|
|
}
|
|
|
|
// List retrieves a list of custom emojis.
|
|
// sortBy parameter can be: "name".
|
|
//
|
|
// Minimum server version: 5.6
|
|
func (e *EmojiService) List(sortBy string, page, count int) ([]*model.Emoji, error) {
|
|
emojis, appErr := e.api.GetEmojiList(sortBy, page, count)
|
|
|
|
return emojis, normalizeAppErr(appErr)
|
|
}
|