model

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// fake team to handle direct messages. Direct Messages does not belong
	// to a particular Team, so to manage them uniformely we use this special team
	DirectMessagesFakeTeam = &Team{Name: "Direct Messages", ID: ""}
)

Functions

func MessageContainsMentions

func MessageContainsMentions(message string, username string) bool

Types

type Channel

type Channel struct {
	ID          string
	DisplayName string
	Members     []string
	Type        string
	TeamID      string
}

func (*Channel) GetChannelName

func (ch *Channel) GetChannelName(user *User) string

func (*Channel) IsDirect

func (ch *Channel) IsDirect() bool

func (*Channel) IsGroup added in v0.1.1

func (ch *Channel) IsGroup() bool

type ChannelMembership

type ChannelMembership struct {
	Channel      *Channel
	User         *User
	LastReadPost time.Time
	NotifyProps  map[string]string
}

func (*ChannelMembership) IsMuted

func (cm *ChannelMembership) IsMuted() bool

type ChannelMissedActivity

type ChannelMissedActivity struct {
	Channel                    *Channel
	User                       *User
	UnreadConversations        []*UnreadConversation
	Logs                       []string
	RepliesInNotFollowingConvs int
	NotifiedByMMMessages       int
	PreviouslyNotified         int
}

func NewChannelMissedActivity

func NewChannelMissedActivity(channel *Channel, user *User) *ChannelMissedActivity

func (*ChannelMissedActivity) AppendLog

func (cma *ChannelMissedActivity) AppendLog(message string, a ...any)

func (*ChannelMissedActivity) GetChannelName

func (cma *ChannelMissedActivity) GetChannelName() string

type MANUserPreferences

type MANUserPreferences struct {
	Enabled                                   bool
	NotifyRepliesInNotFollowedThreads         bool
	IncludeCountOfRepliesInNotFollowedThreads bool
	InlcudeCountOfMessagesNotifiedByMM        bool
	IncludeCountPreviouslyNotified            bool
	IncludeSystemMessages                     bool
	IncludeMessagesFromBots                   bool
}

type Post

type Post struct {
	ID              string
	Message         string
	AuthorID        string
	CreatedAt       time.Time
	RootID          string
	Type            string
	FromBot         bool
	IsSystemMessage bool
}

posts coming from the db

func (*Post) IsRoot

func (p *Post) IsRoot() bool

type Team

type Team struct {
	ID   string
	Name string
}

type TeamMissedActivity

type TeamMissedActivity struct {
	User           *User
	Team           *Team
	UnreadChannels []ChannelMissedActivity
	Logs           []string
}

func (*TeamMissedActivity) AppendLog

func (uma *TeamMissedActivity) AppendLog(message string, a ...any)

type UnreadConversation

type UnreadConversation struct {
	Following           bool
	IsRootMessageUnread bool
	RootPost            *Post
	Replies             []*Post
	MostRecentMessage   time.Time
}

func NewUnreadConversation

func NewUnreadConversation(rootPost *Post, following bool, rootPostUnread bool) *UnreadConversation

func (*UnreadConversation) AppendReply

func (uc *UnreadConversation) AppendReply(post *Post)

func (*UnreadConversation) IsAuthor

func (uc *UnreadConversation) IsAuthor(user *User) bool

type User

type User struct {
	ID             string
	Username       string
	FirstName      string
	LastName       string
	Email          string
	EmailVerified  bool
	Active         bool
	Roles          []string
	Status         string
	IsBot          bool
	EmailsEnabled  bool
	Image          []byte
	MANPreferences MANUserPreferences
	AltText        string // alternative text to show if the user photo cannot be visualized (e.g. in GMail client)
}

func (*User) DisplayName

func (u *User) DisplayName() string

func (*User) IsAdmin

func (u *User) IsAdmin() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL