dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

data.go (1697B)


      1 package v1
      2 
      3 import (
      4 	"dkforest/pkg/database"
      5 	"dkforest/pkg/managers"
      6 	"encoding/json"
      7 )
      8 
      9 type chatTopBarData struct {
     10 	RoomName       string
     11 	Multiline      bool
     12 	Message        string
     13 	QueryParams    string
     14 	QueryParamsMl  string
     15 	QueryParamsNml string
     16 	Error          string
     17 	Success        string
     18 	CommandsList   []string
     19 }
     20 
     21 type chatControlsData struct {
     22 	RoomName        string
     23 	IsStream        bool
     24 	ToggleMentions  bool
     25 	TogglePms       int64
     26 	ChatQueryParams string
     27 }
     28 
     29 type ChatMenuData struct {
     30 	InboxCount          int64
     31 	OfficialRooms       []database.ChatRoomAug1
     32 	SubscribedRooms     []database.ChatRoomAug1
     33 	Members             []managers.UserInfo
     34 	MembersInChat       []managers.UserInfo
     35 	VisibleMemberInChat bool // either or not at least 1 user is "visible" (not hellbanned)
     36 	RoomName            string
     37 	TopBarQueryParams   string
     38 	PreventRefresh      bool
     39 }
     40 
     41 type ChatMessagesData struct {
     42 	ChatMenuData
     43 	NbButtons            int64
     44 	Messages             []database.ChatMessage
     45 	RoomName             string
     46 	ManualRefreshTimeout int64
     47 	ReadMarker           database.ChatReadMarker
     48 	ForceManualRefresh   bool
     49 	NewMessageSound      bool
     50 	TaggedSound          bool
     51 	PmSound              bool
     52 	Error                string
     53 	ErrorTs              int64
     54 	HideRightColumn      bool
     55 	HideTimestamps       bool
     56 }
     57 
     58 func (c ChatMessagesData) MarshalJSON() ([]byte, error) {
     59 	return json.Marshal(&struct {
     60 		Members  []managers.UserInfo
     61 		Messages []database.ChatMessage
     62 	}{
     63 		Members:  c.Members,
     64 		Messages: c.Messages,
     65 	})
     66 }
     67 
     68 type testData struct {
     69 	NewMessageSound      bool
     70 	TaggedSound          bool
     71 	PmSound              bool
     72 	InboxCount           int64
     73 	LastMessageCreatedAt string
     74 }