diff --git a/common/topic.go b/common/topic.go index 749b6c20..437c4079 100644 --- a/common/topic.go +++ b/common/topic.go @@ -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 { diff --git a/docs/configuration.md b/docs/configuration.md index 613ed02a..477c7b71 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -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 diff --git a/routes/topic.go b/routes/topic.go index c5eb1e18..da4a888b 100644 --- a/routes/topic.go +++ b/routes/topic.go @@ -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 }