From eeac199b1e34f451491baabfd7c5798cee84e549 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sun, 5 Aug 2018 10:02:30 +1000 Subject: [PATCH] more sfw fixes --- contrib/backends/srndv2/src/srnd/model_mem.go | 9 +++++++-- contrib/templates/placebo/thread.mustache | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/contrib/backends/srndv2/src/srnd/model_mem.go b/contrib/backends/srndv2/src/srnd/model_mem.go index b6ab41d..6a09ae5 100644 --- a/contrib/backends/srndv2/src/srnd/model_mem.go +++ b/contrib/backends/srndv2/src/srnd/model_mem.go @@ -639,7 +639,7 @@ type thread struct { _i18n *I18N allowFiles bool prefix string - links []LinkModel + links []linkModel Posts []PostModel SFW bool dirty bool @@ -685,6 +685,11 @@ func (self *thread) Navbar() string { param := make(map[string]interface{}) param["name"] = fmt.Sprintf("Thread %s", self.Posts[0].ShortHash()) param["frontend"] = self.Board() + + for idx := range self.links { + self.links[idx].link += "?sfw=1" + } + param["links"] = self.links param["prefix"] = self.prefix return template.renderTemplate("navbar", param, self._i18n) @@ -725,7 +730,7 @@ func createThreadModel(posts ...PostModel) ThreadModel { dirty: true, prefix: prefix, Posts: posts, - links: []LinkModel{ + links: []linkModel{ linkModel{ text: group, link: fmt.Sprintf("%sb/%s/", prefix, group), diff --git a/contrib/templates/placebo/thread.mustache b/contrib/templates/placebo/thread.mustache index 9709a2b..27abe16 100644 --- a/contrib/templates/placebo/thread.mustache +++ b/contrib/templates/placebo/thread.mustache @@ -25,7 +25,11 @@ + {{sfw}} + + {{#sfw}} + {{/sfw}} @@ -33,7 +37,11 @@ {{{thread.Navbar}}}
+ {{sfw}} +

CHANGOLIA

+ {{#sfw}}

CHANGOLIA

+ {{/sfw}} Most of the rest of the wild west.
{{thread.Board}}