mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 14:02:25 -05:00
[feature] User muting (#2960)
* User muting * Address review feedback * Rename uniqueness constraint on user_mutes to match convention * Remove unused account_id from where clause * Add UserMute to NewTestDB * Update test/envparsing.sh with new and fixed cache stuff * Address tobi's review comments * Make compiledUserMuteListEntry.expired consistent with UserMute.Expired * Make sure mute_expires_at is serialized as an explicit null for indefinite mutes --------- Co-authored-by: tobi <tobi.smethurst@protonmail.com>
This commit is contained in:
parent
b371c2db47
commit
5e2d4fdb19
47 changed files with 2346 additions and 53 deletions
|
|
@ -2,7 +2,7 @@
|
|||
// GoToSocial
|
||||
// Copyright (C) GoToSocial Authors admin@gotosocial.org
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
//
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
|
|
@ -2917,7 +2917,7 @@ func (st *ConfigState) SetCacheBlockIDsMemRatio(v float64) {
|
|||
}
|
||||
|
||||
// CacheBlockIDsMemRatioFlag returns the flag name for the 'Cache.BlockIDsMemRatio' field
|
||||
func CacheBlockIDsMemRatioFlag() string { return "cache-block-mem-ratio" }
|
||||
func CacheBlockIDsMemRatioFlag() string { return "cache-block-ids-mem-ratio" }
|
||||
|
||||
// GetCacheBlockIDsMemRatio safely fetches the value for global configuration 'Cache.BlockIDsMemRatio' field
|
||||
func GetCacheBlockIDsMemRatio() float64 { return global.GetCacheBlockIDsMemRatio() }
|
||||
|
|
@ -3775,6 +3775,56 @@ func GetCacheUserMemRatio() float64 { return global.GetCacheUserMemRatio() }
|
|||
// SetCacheUserMemRatio safely sets the value for global configuration 'Cache.UserMemRatio' field
|
||||
func SetCacheUserMemRatio(v float64) { global.SetCacheUserMemRatio(v) }
|
||||
|
||||
// GetCacheUserMuteMemRatio safely fetches the Configuration value for state's 'Cache.UserMuteMemRatio' field
|
||||
func (st *ConfigState) GetCacheUserMuteMemRatio() (v float64) {
|
||||
st.mutex.RLock()
|
||||
v = st.config.Cache.UserMuteMemRatio
|
||||
st.mutex.RUnlock()
|
||||
return
|
||||
}
|
||||
|
||||
// SetCacheUserMuteMemRatio safely sets the Configuration value for state's 'Cache.UserMuteMemRatio' field
|
||||
func (st *ConfigState) SetCacheUserMuteMemRatio(v float64) {
|
||||
st.mutex.Lock()
|
||||
defer st.mutex.Unlock()
|
||||
st.config.Cache.UserMuteMemRatio = v
|
||||
st.reloadToViper()
|
||||
}
|
||||
|
||||
// CacheUserMuteMemRatioFlag returns the flag name for the 'Cache.UserMuteMemRatio' field
|
||||
func CacheUserMuteMemRatioFlag() string { return "cache-user-mute-mem-ratio" }
|
||||
|
||||
// GetCacheUserMuteMemRatio safely fetches the value for global configuration 'Cache.UserMuteMemRatio' field
|
||||
func GetCacheUserMuteMemRatio() float64 { return global.GetCacheUserMuteMemRatio() }
|
||||
|
||||
// SetCacheUserMuteMemRatio safely sets the value for global configuration 'Cache.UserMuteMemRatio' field
|
||||
func SetCacheUserMuteMemRatio(v float64) { global.SetCacheUserMuteMemRatio(v) }
|
||||
|
||||
// GetCacheUserMuteIDsMemRatio safely fetches the Configuration value for state's 'Cache.UserMuteIDsMemRatio' field
|
||||
func (st *ConfigState) GetCacheUserMuteIDsMemRatio() (v float64) {
|
||||
st.mutex.RLock()
|
||||
v = st.config.Cache.UserMuteIDsMemRatio
|
||||
st.mutex.RUnlock()
|
||||
return
|
||||
}
|
||||
|
||||
// SetCacheUserMuteIDsMemRatio safely sets the Configuration value for state's 'Cache.UserMuteIDsMemRatio' field
|
||||
func (st *ConfigState) SetCacheUserMuteIDsMemRatio(v float64) {
|
||||
st.mutex.Lock()
|
||||
defer st.mutex.Unlock()
|
||||
st.config.Cache.UserMuteIDsMemRatio = v
|
||||
st.reloadToViper()
|
||||
}
|
||||
|
||||
// CacheUserMuteIDsMemRatioFlag returns the flag name for the 'Cache.UserMuteIDsMemRatio' field
|
||||
func CacheUserMuteIDsMemRatioFlag() string { return "cache-user-mute-ids-mem-ratio" }
|
||||
|
||||
// GetCacheUserMuteIDsMemRatio safely fetches the value for global configuration 'Cache.UserMuteIDsMemRatio' field
|
||||
func GetCacheUserMuteIDsMemRatio() float64 { return global.GetCacheUserMuteIDsMemRatio() }
|
||||
|
||||
// SetCacheUserMuteIDsMemRatio safely sets the value for global configuration 'Cache.UserMuteIDsMemRatio' field
|
||||
func SetCacheUserMuteIDsMemRatio(v float64) { global.SetCacheUserMuteIDsMemRatio(v) }
|
||||
|
||||
// GetCacheWebfingerMemRatio safely fetches the Configuration value for state's 'Cache.WebfingerMemRatio' field
|
||||
func (st *ConfigState) GetCacheWebfingerMemRatio() (v float64) {
|
||||
st.mutex.RLock()
|
||||
|
|
@ -4024,3 +4074,4 @@ func GetRequestIDHeader() string { return global.GetRequestIDHeader() }
|
|||
|
||||
// SetRequestIDHeader safely sets the value for global configuration 'RequestIDHeader' field
|
||||
func SetRequestIDHeader(v string) { global.SetRequestIDHeader(v) }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue