Config.NoEmbed should override user preferences.
This commit is contained in:
parent
c4f2f0df90
commit
5ac7739648
@ -634,7 +634,7 @@ func (ru *ReplyUser) Init2() (group *Group, err error) {
|
||||
|
||||
postGroup, err := Groups.Get(ru.Group)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return postGroup, err
|
||||
}
|
||||
if postGroup.IsMod {
|
||||
ru.ClassName = Config.StaffCSS
|
||||
@ -679,7 +679,7 @@ func (ru *ReplyUser) Init3(u *User, tu *TopicUser) (group *Group, err error) {
|
||||
|
||||
postGroup, err := Groups.Get(ru.Group)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return postGroup, err
|
||||
}
|
||||
if postGroup.IsMod {
|
||||
ru.ClassName = Config.StaffCSS
|
||||
@ -760,14 +760,14 @@ func (t *TopicUser) Replies(offset int /*pFrag int, */, user *User) (rlist []*Re
|
||||
hTbl := GetHookTable()
|
||||
rf := func(r *ReplyUser) (err error) {
|
||||
//log.Printf("before r: %+v\n", r)
|
||||
group, err := r.Init3(user, t)
|
||||
postGroup, err := r.Init3(user, t)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
//log.Printf("after r: %+v\n", r)
|
||||
|
||||
var parseSettings *ParseSettings
|
||||
if !group.Perms.AutoEmbed && (user.ParseSettings == nil || !user.ParseSettings.NoEmbed) {
|
||||
if (Config.NoEmbed || !postGroup.Perms.AutoEmbed) && (user.ParseSettings == nil || !user.ParseSettings.NoEmbed) {
|
||||
parseSettings = DefaultParseSettings.CopyPtr()
|
||||
parseSettings.NoEmbed = true
|
||||
} else {
|
||||
@ -798,13 +798,13 @@ func (t *TopicUser) Replies(offset int /*pFrag int, */, user *User) (rlist []*Re
|
||||
|
||||
rf3 := func(r *ReplyUser) error {
|
||||
//log.Printf("before r: %+v\n", r)
|
||||
group, err := r.Init2()
|
||||
postGroup, err := r.Init2()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
var parseSettings *ParseSettings
|
||||
if !group.Perms.AutoEmbed && (user.ParseSettings == nil || !user.ParseSettings.NoEmbed) {
|
||||
if (Config.NoEmbed || !postGroup.Perms.AutoEmbed) && (user.ParseSettings == nil || !user.ParseSettings.NoEmbed) {
|
||||
parseSettings = DefaultParseSettings.CopyPtr()
|
||||
parseSettings.NoEmbed = true
|
||||
} else {
|
||||
|
@ -124,7 +124,7 @@ RefNoTrack - This switch disables tracking the referrers of users who click from
|
||||
|
||||
RefNoRef - This switch makes it so that if a user clicks on a link, then the incoming site won't know which site they're coming from.
|
||||
|
||||
NoEmbed - Avoid expanding links into videos or images. Default: false
|
||||
NoEmbed - Don't expand links into videos or images. Default: false
|
||||
|
||||
NoAvatar - The default avatar to use for users when they don't have their own. The default for this may change in the near future to better utilise HTTP/2. Example: https://api.adorable.io/avatars/{width}/{id}.png
|
||||
|
||||
|
@ -86,7 +86,7 @@ func ViewTopic(w http.ResponseWriter, r *http.Request, user *c.User, h *c.Header
|
||||
}
|
||||
|
||||
var parseSettings *c.ParseSettings
|
||||
if !postGroup.Perms.AutoEmbed && (user.ParseSettings == nil || !user.ParseSettings.NoEmbed) {
|
||||
if (c.Config.NoEmbed || !postGroup.Perms.AutoEmbed) && (user.ParseSettings == nil || !user.ParseSettings.NoEmbed) {
|
||||
parseSettings = c.DefaultParseSettings.CopyPtr()
|
||||
parseSettings.NoEmbed = true
|
||||
} else {
|
||||
@ -226,7 +226,7 @@ func AttachTopicActCommon(w http.ResponseWriter, r *http.Request, u *c.User, sti
|
||||
// TODO: Enforce the max request limit on all of this topic's attachments
|
||||
// TODO: Test this route
|
||||
func AddAttachToTopicSubmit(w http.ResponseWriter, r *http.Request, u *c.User, stid string) c.RouteError {
|
||||
topic, ferr := AttachTopicActCommon(w,r,u,stid)
|
||||
topic, ferr := AttachTopicActCommon(w, r, u, stid)
|
||||
if ferr != nil {
|
||||
return ferr
|
||||
}
|
||||
@ -257,7 +257,7 @@ func AddAttachToTopicSubmit(w http.ResponseWriter, r *http.Request, u *c.User, s
|
||||
}
|
||||
|
||||
func RemoveAttachFromTopicSubmit(w http.ResponseWriter, r *http.Request, u *c.User, stid string) c.RouteError {
|
||||
_, ferr := AttachTopicActCommon(w,r,u,stid)
|
||||
_, ferr := AttachTopicActCommon(w, r, u, stid)
|
||||
if ferr != nil {
|
||||
return ferr
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user