2017-09-15 22:20:01 +00:00
|
|
|
/* Under Heavy Construction */
|
2017-09-13 15:09:13 +00:00
|
|
|
package main
|
|
|
|
|
2017-09-15 22:20:01 +00:00
|
|
|
import (
|
2017-11-02 13:35:19 +00:00
|
|
|
"database/sql"
|
2017-09-15 22:20:01 +00:00
|
|
|
"encoding/json"
|
|
|
|
"errors"
|
|
|
|
"log"
|
2017-11-02 13:35:19 +00:00
|
|
|
"sort"
|
2017-09-15 22:20:01 +00:00
|
|
|
"sync"
|
2017-10-21 00:27:47 +00:00
|
|
|
|
|
|
|
"./query_gen/lib"
|
2017-09-15 22:20:01 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var gstore GroupStore
|
|
|
|
|
Added Quick Topic.
Added Attachments.
Added Attachment Media Embeds.
Renamed a load of *Store and *Cache methods to reduce the amount of unneccesary typing.
Added petabytes as a unit and cleaned up a few of the friendly units.
Refactored the username change logic to make it easier to maintain.
Refactored the avatar change logic to make it easier to maintain.
Shadow now uses CSS Variables for most of it's colours. We have plans to transpile this to support older browsers later on!
Snuck some CSS Variables into Tempra Conflux.
Added the GroupCache interface to MemoryGroupStore.
Added the Length method to MemoryGroupStore.
Added support for a site short name.
Added the UploadFiles permission.
Renamed more functions.
Fixed the background for the left gutter on the postbit for Tempra Simple and Shadow.
Added support for if statements operating on int8, int16, int32, int32, int64, uint, uint8, uint16, uint32, uint64, float32, and float64 for the template compiler.
Added support for if statements operating on slices and maps for the template compiler.
Fixed a security exploit in reply editing.
Fixed a bug in the URL detector in the parser where it couldn't find URLs with non-standard ports.
Fixed buttons having blue outlines on focus on Shadow.
Refactored the topic creation logic to make it easier to maintain.
Made a few responsive fixes, but there's still more to do in the following commits!
2017-10-05 10:20:28 +00:00
|
|
|
// ? - We could fallback onto the database when an item can't be found in the cache?
|
2017-09-15 22:20:01 +00:00
|
|
|
type GroupStore interface {
|
|
|
|
LoadGroups() error
|
|
|
|
DirtyGet(id int) *Group
|
|
|
|
Get(id int) (*Group, error)
|
|
|
|
GetCopy(id int) (Group, error)
|
|
|
|
Exists(id int) bool
|
2017-10-21 00:27:47 +00:00
|
|
|
Create(name string, tag string, isAdmin bool, isMod bool, isBanned bool) (int, error)
|
2017-09-15 22:20:01 +00:00
|
|
|
GetAll() ([]*Group, error)
|
|
|
|
GetRange(lower int, higher int) ([]*Group, error)
|
2017-11-02 13:35:19 +00:00
|
|
|
Reload(id int) error // ? - Should we move this to GroupCache? It might require us to do some unnecessary casting though
|
|
|
|
GlobalCount() int
|
2017-09-15 22:20:01 +00:00
|
|
|
}
|
|
|
|
|
Added Quick Topic.
Added Attachments.
Added Attachment Media Embeds.
Renamed a load of *Store and *Cache methods to reduce the amount of unneccesary typing.
Added petabytes as a unit and cleaned up a few of the friendly units.
Refactored the username change logic to make it easier to maintain.
Refactored the avatar change logic to make it easier to maintain.
Shadow now uses CSS Variables for most of it's colours. We have plans to transpile this to support older browsers later on!
Snuck some CSS Variables into Tempra Conflux.
Added the GroupCache interface to MemoryGroupStore.
Added the Length method to MemoryGroupStore.
Added support for a site short name.
Added the UploadFiles permission.
Renamed more functions.
Fixed the background for the left gutter on the postbit for Tempra Simple and Shadow.
Added support for if statements operating on int8, int16, int32, int32, int64, uint, uint8, uint16, uint32, uint64, float32, and float64 for the template compiler.
Added support for if statements operating on slices and maps for the template compiler.
Fixed a security exploit in reply editing.
Fixed a bug in the URL detector in the parser where it couldn't find URLs with non-standard ports.
Fixed buttons having blue outlines on focus on Shadow.
Refactored the topic creation logic to make it easier to maintain.
Made a few responsive fixes, but there's still more to do in the following commits!
2017-10-05 10:20:28 +00:00
|
|
|
type GroupCache interface {
|
2017-11-02 13:35:19 +00:00
|
|
|
CacheSet(group *Group) error
|
Added Quick Topic.
Added Attachments.
Added Attachment Media Embeds.
Renamed a load of *Store and *Cache methods to reduce the amount of unneccesary typing.
Added petabytes as a unit and cleaned up a few of the friendly units.
Refactored the username change logic to make it easier to maintain.
Refactored the avatar change logic to make it easier to maintain.
Shadow now uses CSS Variables for most of it's colours. We have plans to transpile this to support older browsers later on!
Snuck some CSS Variables into Tempra Conflux.
Added the GroupCache interface to MemoryGroupStore.
Added the Length method to MemoryGroupStore.
Added support for a site short name.
Added the UploadFiles permission.
Renamed more functions.
Fixed the background for the left gutter on the postbit for Tempra Simple and Shadow.
Added support for if statements operating on int8, int16, int32, int32, int64, uint, uint8, uint16, uint32, uint64, float32, and float64 for the template compiler.
Added support for if statements operating on slices and maps for the template compiler.
Fixed a security exploit in reply editing.
Fixed a bug in the URL detector in the parser where it couldn't find URLs with non-standard ports.
Fixed buttons having blue outlines on focus on Shadow.
Refactored the topic creation logic to make it easier to maintain.
Made a few responsive fixes, but there's still more to do in the following commits!
2017-10-05 10:20:28 +00:00
|
|
|
Length() int
|
|
|
|
}
|
|
|
|
|
2017-09-15 22:20:01 +00:00
|
|
|
type MemoryGroupStore struct {
|
2017-11-02 13:35:19 +00:00
|
|
|
groups map[int]*Group // TODO: Use a sync.Map instead of a map?
|
|
|
|
groupCount int
|
|
|
|
get *sql.Stmt
|
|
|
|
|
|
|
|
sync.RWMutex
|
2017-09-15 22:20:01 +00:00
|
|
|
}
|
|
|
|
|
2017-11-02 13:35:19 +00:00
|
|
|
func NewMemoryGroupStore() (*MemoryGroupStore, error) {
|
|
|
|
getGroupStmt, err := qgen.Builder.SimpleSelect("users_groups", "name, permissions, plugin_perms, is_mod, is_admin, is_banned, tag", "gid = ?", "", "")
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
return &MemoryGroupStore{
|
|
|
|
groups: make(map[int]*Group),
|
|
|
|
groupCount: 0,
|
|
|
|
get: getGroupStmt,
|
|
|
|
}, nil
|
2017-09-15 22:20:01 +00:00
|
|
|
}
|
|
|
|
|
2017-11-05 09:55:34 +00:00
|
|
|
// TODO: Move this query from the global stmt store into this store
|
2017-09-15 22:20:01 +00:00
|
|
|
func (mgs *MemoryGroupStore) LoadGroups() error {
|
2017-11-02 13:35:19 +00:00
|
|
|
mgs.Lock()
|
|
|
|
defer mgs.Unlock()
|
|
|
|
mgs.groups[0] = &Group{ID: 0, Name: "Unknown"}
|
2017-09-15 22:20:01 +00:00
|
|
|
|
2017-11-05 09:55:34 +00:00
|
|
|
rows, err := stmts.getGroups.Query()
|
2017-09-15 22:20:01 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
defer rows.Close()
|
|
|
|
|
|
|
|
i := 1
|
|
|
|
for ; rows.Next(); i++ {
|
2017-11-02 13:35:19 +00:00
|
|
|
group := &Group{ID: 0}
|
2017-09-15 22:20:01 +00:00
|
|
|
err := rows.Scan(&group.ID, &group.Name, &group.PermissionsText, &group.PluginPermsText, &group.IsMod, &group.IsAdmin, &group.IsBanned, &group.Tag)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
2017-11-02 13:35:19 +00:00
|
|
|
err = mgs.initGroup(group)
|
2017-09-15 22:20:01 +00:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2017-11-02 13:35:19 +00:00
|
|
|
mgs.groups[group.ID] = group
|
2017-09-15 22:20:01 +00:00
|
|
|
}
|
|
|
|
err = rows.Err()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2017-11-02 13:35:19 +00:00
|
|
|
mgs.groupCount = i
|
2017-09-15 22:20:01 +00:00
|
|
|
|
|
|
|
if dev.DebugMode {
|
|
|
|
log.Print("Binding the Not Loggedin Group")
|
|
|
|
}
|
2017-11-02 13:35:19 +00:00
|
|
|
GuestPerms = mgs.dirtyGetUnsafe(6).Perms
|
2017-09-15 22:20:01 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2017-11-02 13:35:19 +00:00
|
|
|
// TODO: Hit the database when the item isn't in memory
|
|
|
|
func (mgs *MemoryGroupStore) dirtyGetUnsafe(gid int) *Group {
|
|
|
|
group, ok := mgs.groups[gid]
|
|
|
|
if !ok {
|
|
|
|
return &blankGroup
|
|
|
|
}
|
|
|
|
return group
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Hit the database when the item isn't in memory
|
2017-09-15 22:20:01 +00:00
|
|
|
func (mgs *MemoryGroupStore) DirtyGet(gid int) *Group {
|
2017-11-02 13:35:19 +00:00
|
|
|
mgs.RLock()
|
|
|
|
group, ok := mgs.groups[gid]
|
|
|
|
mgs.RUnlock()
|
|
|
|
if !ok {
|
2017-09-15 22:20:01 +00:00
|
|
|
return &blankGroup
|
|
|
|
}
|
2017-11-02 13:35:19 +00:00
|
|
|
return group
|
2017-09-15 22:20:01 +00:00
|
|
|
}
|
|
|
|
|
2017-11-02 13:35:19 +00:00
|
|
|
// TODO: Hit the database when the item isn't in memory
|
2017-09-15 22:20:01 +00:00
|
|
|
func (mgs *MemoryGroupStore) Get(gid int) (*Group, error) {
|
2017-11-02 13:35:19 +00:00
|
|
|
mgs.RLock()
|
|
|
|
group, ok := mgs.groups[gid]
|
|
|
|
mgs.RUnlock()
|
|
|
|
if !ok {
|
2017-09-15 22:20:01 +00:00
|
|
|
return nil, ErrNoRows
|
|
|
|
}
|
2017-11-02 13:35:19 +00:00
|
|
|
return group, nil
|
2017-09-15 22:20:01 +00:00
|
|
|
}
|
|
|
|
|
2017-11-02 13:35:19 +00:00
|
|
|
// TODO: Hit the database when the item isn't in memory
|
2017-09-15 22:20:01 +00:00
|
|
|
func (mgs *MemoryGroupStore) GetCopy(gid int) (Group, error) {
|
2017-11-02 13:35:19 +00:00
|
|
|
mgs.RLock()
|
|
|
|
group, ok := mgs.groups[gid]
|
|
|
|
mgs.RUnlock()
|
|
|
|
if !ok {
|
2017-09-15 22:20:01 +00:00
|
|
|
return blankGroup, ErrNoRows
|
|
|
|
}
|
2017-11-02 13:35:19 +00:00
|
|
|
return *group, nil
|
2017-09-15 22:20:01 +00:00
|
|
|
}
|
|
|
|
|
2017-11-02 13:35:19 +00:00
|
|
|
func (mgs *MemoryGroupStore) Reload(id int) error {
|
|
|
|
var group = &Group{ID: id}
|
|
|
|
err := mgs.get.QueryRow(id).Scan(&group.Name, &group.PermissionsText, &group.PluginPermsText, &group.IsMod, &group.IsAdmin, &group.IsBanned, &group.Tag)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
|
|
|
|
err = mgs.initGroup(group)
|
|
|
|
if err != nil {
|
|
|
|
LogError(err)
|
|
|
|
}
|
|
|
|
mgs.CacheSet(group)
|
|
|
|
|
|
|
|
err = rebuildGroupPermissions(id)
|
|
|
|
if err != nil {
|
|
|
|
LogError(err)
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mgs *MemoryGroupStore) initGroup(group *Group) error {
|
|
|
|
err := json.Unmarshal(group.PermissionsText, &group.Perms)
|
|
|
|
if err != nil {
|
2017-11-05 01:04:57 +00:00
|
|
|
log.Printf("group: %+v\n", group)
|
|
|
|
log.Print("bad group perms: ", group.PermissionsText)
|
2017-11-02 13:35:19 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
if dev.DebugMode {
|
2017-11-05 01:04:57 +00:00
|
|
|
log.Printf(group.Name+": %+v\n", group.Perms)
|
2017-11-02 13:35:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
err = json.Unmarshal(group.PluginPermsText, &group.PluginPerms)
|
|
|
|
if err != nil {
|
2017-11-05 01:04:57 +00:00
|
|
|
log.Printf("group: %+v\n", group)
|
|
|
|
log.Print("bad group plugin perms: ", group.PluginPermsText)
|
2017-11-02 13:35:19 +00:00
|
|
|
return err
|
|
|
|
}
|
|
|
|
if dev.DebugMode {
|
2017-11-05 01:04:57 +00:00
|
|
|
log.Printf(group.Name+": %+v\n", group.PluginPerms)
|
2017-11-02 13:35:19 +00:00
|
|
|
}
|
2017-11-05 01:04:57 +00:00
|
|
|
|
2017-11-02 13:35:19 +00:00
|
|
|
//group.Perms.ExtData = make(map[string]bool)
|
|
|
|
// TODO: Can we optimise the bit where this cascades down to the user now?
|
|
|
|
if group.IsAdmin || group.IsMod {
|
|
|
|
group.IsBanned = false
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mgs *MemoryGroupStore) CacheSet(group *Group) error {
|
|
|
|
mgs.Lock()
|
|
|
|
mgs.groups[group.ID] = group
|
|
|
|
mgs.Unlock()
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Hit the database when the item isn't in memory
|
2017-09-15 22:20:01 +00:00
|
|
|
func (mgs *MemoryGroupStore) Exists(gid int) bool {
|
2017-11-02 13:35:19 +00:00
|
|
|
mgs.RLock()
|
|
|
|
group, ok := mgs.groups[gid]
|
|
|
|
mgs.RUnlock()
|
|
|
|
return ok && group.Name != ""
|
2017-09-15 22:20:01 +00:00
|
|
|
}
|
|
|
|
|
2017-10-21 00:27:47 +00:00
|
|
|
// ? Allow two groups with the same name?
|
2017-11-02 13:35:19 +00:00
|
|
|
func (mgs *MemoryGroupStore) Create(name string, tag string, isAdmin bool, isMod bool, isBanned bool) (gid int, err error) {
|
2017-09-15 22:20:01 +00:00
|
|
|
var permstr = "{}"
|
2017-10-21 00:27:47 +00:00
|
|
|
tx, err := db.Begin()
|
|
|
|
if err != nil {
|
|
|
|
return 0, err
|
|
|
|
}
|
|
|
|
defer tx.Rollback()
|
|
|
|
|
2017-11-05 01:04:57 +00:00
|
|
|
insertTx, err := qgen.Builder.SimpleInsertTx(tx, "users_groups", "name, tag, is_admin, is_mod, is_banned, permissions, plugin_perms", "?,?,?,?,?,?,'{}'")
|
2017-10-21 00:27:47 +00:00
|
|
|
if err != nil {
|
|
|
|
return 0, err
|
|
|
|
}
|
|
|
|
res, err := insertTx.Exec(name, tag, isAdmin, isMod, isBanned, permstr)
|
2017-09-15 22:20:01 +00:00
|
|
|
if err != nil {
|
|
|
|
return 0, err
|
|
|
|
}
|
|
|
|
|
|
|
|
gid64, err := res.LastInsertId()
|
|
|
|
if err != nil {
|
|
|
|
return 0, err
|
|
|
|
}
|
2017-11-02 13:35:19 +00:00
|
|
|
gid = int(gid64)
|
2017-09-15 22:20:01 +00:00
|
|
|
|
|
|
|
var perms = BlankPerms
|
|
|
|
var blankForums []ForumPerms
|
|
|
|
var blankIntList []int
|
|
|
|
var pluginPerms = make(map[string]bool)
|
|
|
|
var pluginPermsBytes = []byte("{}")
|
|
|
|
if vhooks["create_group_preappend"] != nil {
|
|
|
|
runVhook("create_group_preappend", &pluginPerms, &pluginPermsBytes)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Generate the forum permissions based on the presets...
|
|
|
|
fdata, err := fstore.GetAll()
|
|
|
|
if err != nil {
|
|
|
|
return 0, err
|
|
|
|
}
|
|
|
|
|
2017-10-21 00:27:47 +00:00
|
|
|
var presetSet = make(map[int]string)
|
|
|
|
var permSet = make(map[int]ForumPerms)
|
2017-09-15 22:20:01 +00:00
|
|
|
permUpdateMutex.Lock()
|
|
|
|
defer permUpdateMutex.Unlock()
|
|
|
|
for _, forum := range fdata {
|
|
|
|
var thePreset string
|
|
|
|
if isAdmin {
|
|
|
|
thePreset = "admins"
|
|
|
|
} else if isMod {
|
|
|
|
thePreset = "staff"
|
|
|
|
} else if isBanned {
|
|
|
|
thePreset = "banned"
|
|
|
|
} else {
|
|
|
|
thePreset = "members"
|
|
|
|
}
|
|
|
|
|
|
|
|
permmap := presetToPermmap(forum.Preset)
|
2017-10-21 00:27:47 +00:00
|
|
|
permItem := permmap[thePreset]
|
|
|
|
permItem.Overrides = true
|
|
|
|
|
|
|
|
permSet[forum.ID] = permItem
|
|
|
|
presetSet[forum.ID] = forum.Preset
|
|
|
|
}
|
|
|
|
|
|
|
|
err = replaceForumPermsForGroupTx(tx, gid, presetSet, permSet)
|
|
|
|
if err != nil {
|
|
|
|
return 0, err
|
|
|
|
}
|
|
|
|
|
|
|
|
err = tx.Commit()
|
|
|
|
if err != nil {
|
|
|
|
return 0, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Can we optimise the bit where this cascades down to the user now?
|
|
|
|
if isAdmin || isMod {
|
|
|
|
isBanned = false
|
|
|
|
}
|
|
|
|
|
2017-11-02 13:35:19 +00:00
|
|
|
mgs.Lock()
|
|
|
|
mgs.groups[gid] = &Group{gid, name, isMod, isAdmin, isBanned, tag, perms, []byte(permstr), pluginPerms, pluginPermsBytes, blankForums, blankIntList}
|
|
|
|
mgs.groupCount++
|
|
|
|
mgs.Unlock()
|
2017-09-15 22:20:01 +00:00
|
|
|
|
2017-10-21 00:27:47 +00:00
|
|
|
for _, forum := range fdata {
|
2017-11-05 01:04:57 +00:00
|
|
|
err = fpstore.Reload(forum.ID)
|
2017-09-15 22:20:01 +00:00
|
|
|
if err != nil {
|
|
|
|
return gid, err
|
|
|
|
}
|
|
|
|
}
|
2017-10-21 00:27:47 +00:00
|
|
|
|
2017-09-15 22:20:01 +00:00
|
|
|
return gid, nil
|
|
|
|
}
|
|
|
|
|
2017-11-02 13:35:19 +00:00
|
|
|
func (mgs *MemoryGroupStore) GetAll() (results []*Group, err error) {
|
|
|
|
var i int
|
|
|
|
mgs.RLock()
|
|
|
|
results = make([]*Group, len(mgs.groups))
|
|
|
|
for _, group := range mgs.groups {
|
|
|
|
results[i] = group
|
|
|
|
i++
|
|
|
|
}
|
|
|
|
mgs.RUnlock()
|
|
|
|
sort.Sort(SortGroup(results))
|
|
|
|
return results, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mgs *MemoryGroupStore) GetAllMap() (map[int]*Group, error) {
|
|
|
|
mgs.RLock()
|
|
|
|
defer mgs.RUnlock()
|
2017-09-15 22:20:01 +00:00
|
|
|
return mgs.groups, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// ? - Set the lower and higher numbers to 0 to remove the bounds
|
2017-11-02 13:35:19 +00:00
|
|
|
// TODO: Might be a little slow right now, maybe we can cache the groups in a slice or break the map up into chunks
|
2017-09-15 22:20:01 +00:00
|
|
|
func (mgs *MemoryGroupStore) GetRange(lower int, higher int) (groups []*Group, err error) {
|
|
|
|
if lower == 0 && higher == 0 {
|
|
|
|
return mgs.GetAll()
|
2017-11-02 13:35:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if lower == 0 {
|
2017-09-15 22:20:01 +00:00
|
|
|
if higher < 0 {
|
|
|
|
return nil, errors.New("higher may not be lower than 0")
|
|
|
|
}
|
|
|
|
} else if higher == 0 {
|
|
|
|
if lower < 0 {
|
|
|
|
return nil, errors.New("lower may not be lower than 0")
|
|
|
|
}
|
|
|
|
}
|
2017-11-02 13:35:19 +00:00
|
|
|
|
|
|
|
mgs.RLock()
|
|
|
|
for gid, group := range mgs.groups {
|
|
|
|
if gid >= lower && (gid <= higher || higher == 0) {
|
|
|
|
groups = append(groups, group)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mgs.RUnlock()
|
|
|
|
sort.Sort(SortGroup(groups))
|
|
|
|
|
2017-09-15 22:20:01 +00:00
|
|
|
return groups, nil
|
|
|
|
}
|
Added Quick Topic.
Added Attachments.
Added Attachment Media Embeds.
Renamed a load of *Store and *Cache methods to reduce the amount of unneccesary typing.
Added petabytes as a unit and cleaned up a few of the friendly units.
Refactored the username change logic to make it easier to maintain.
Refactored the avatar change logic to make it easier to maintain.
Shadow now uses CSS Variables for most of it's colours. We have plans to transpile this to support older browsers later on!
Snuck some CSS Variables into Tempra Conflux.
Added the GroupCache interface to MemoryGroupStore.
Added the Length method to MemoryGroupStore.
Added support for a site short name.
Added the UploadFiles permission.
Renamed more functions.
Fixed the background for the left gutter on the postbit for Tempra Simple and Shadow.
Added support for if statements operating on int8, int16, int32, int32, int64, uint, uint8, uint16, uint32, uint64, float32, and float64 for the template compiler.
Added support for if statements operating on slices and maps for the template compiler.
Fixed a security exploit in reply editing.
Fixed a bug in the URL detector in the parser where it couldn't find URLs with non-standard ports.
Fixed buttons having blue outlines on focus on Shadow.
Refactored the topic creation logic to make it easier to maintain.
Made a few responsive fixes, but there's still more to do in the following commits!
2017-10-05 10:20:28 +00:00
|
|
|
|
|
|
|
func (mgs *MemoryGroupStore) Length() int {
|
2017-11-02 13:35:19 +00:00
|
|
|
mgs.RLock()
|
|
|
|
defer mgs.RUnlock()
|
|
|
|
return mgs.groupCount
|
|
|
|
}
|
|
|
|
|
|
|
|
func (mgs *MemoryGroupStore) GlobalCount() int {
|
|
|
|
mgs.RLock()
|
|
|
|
defer mgs.RUnlock()
|
|
|
|
return mgs.groupCount
|
Added Quick Topic.
Added Attachments.
Added Attachment Media Embeds.
Renamed a load of *Store and *Cache methods to reduce the amount of unneccesary typing.
Added petabytes as a unit and cleaned up a few of the friendly units.
Refactored the username change logic to make it easier to maintain.
Refactored the avatar change logic to make it easier to maintain.
Shadow now uses CSS Variables for most of it's colours. We have plans to transpile this to support older browsers later on!
Snuck some CSS Variables into Tempra Conflux.
Added the GroupCache interface to MemoryGroupStore.
Added the Length method to MemoryGroupStore.
Added support for a site short name.
Added the UploadFiles permission.
Renamed more functions.
Fixed the background for the left gutter on the postbit for Tempra Simple and Shadow.
Added support for if statements operating on int8, int16, int32, int32, int64, uint, uint8, uint16, uint32, uint64, float32, and float64 for the template compiler.
Added support for if statements operating on slices and maps for the template compiler.
Fixed a security exploit in reply editing.
Fixed a bug in the URL detector in the parser where it couldn't find URLs with non-standard ports.
Fixed buttons having blue outlines on focus on Shadow.
Refactored the topic creation logic to make it easier to maintain.
Made a few responsive fixes, but there's still more to do in the following commits!
2017-10-05 10:20:28 +00:00
|
|
|
}
|