backward compatability

This commit is contained in:
Ryan Stafford 2023-12-16 20:09:35 -05:00
parent 3f074ce7ed
commit 3d549f66e8
9 changed files with 21 additions and 35 deletions

9
go.mod
View file

@ -6,14 +6,9 @@ require (
github.com/dustin/go-humanize v1.0.1
github.com/julienschmidt/httprouter v1.3.0
github.com/k3a/html2text v1.2.1
github.com/rystaf/go-lemmy v0.0.0-20230903163721-9db5472b7a03
github.com/rystaf/go-lemmy v0.0.0-20231217010740-5b1f4cc46ca8
github.com/yuin/goldmark v1.5.4
golang.org/x/text v0.10.0
)
require (
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
go.elara.ws/go-lemmy v0.19.0 // indirect
)
require github.com/google/go-querystring v1.1.0 // indirect

12
go.sum
View file

@ -1,5 +1,3 @@
github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4=
github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM=
@ -8,26 +6,20 @@ github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U=
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/k3a/html2text v1.2.1 h1:nvnKgBvBR/myqrwfLuiqecUtaK1lB9hGziIJKatNFVY=
github.com/k3a/html2text v1.2.1/go.mod h1:ieEXykM67iT8lTvEWBh6fhpH4B23kB9OMKPdIBmgUqA=
github.com/rystaf/go-lemmy v0.0.0-20230720221045-c6d79b98e968 h1:wfyB6wQzYMH2U8xQvdamExbyCyPhe4o8HP47FMZM5Jk=
github.com/rystaf/go-lemmy v0.0.0-20230720221045-c6d79b98e968/go.mod h1:nRSkTD+ARAHXtqlSPdf5q3hjHLP1ALsS1m5D3o86o+4=
github.com/rystaf/go-lemmy v0.0.0-20230903163721-9db5472b7a03 h1:g2vV60Mc3naU1NtGvx+l/W7AAckawsPRVmaR/XvcRh0=
github.com/rystaf/go-lemmy v0.0.0-20230903163721-9db5472b7a03/go.mod h1:nRSkTD+ARAHXtqlSPdf5q3hjHLP1ALsS1m5D3o86o+4=
github.com/rystaf/go-lemmy v0.0.0-20231217010740-5b1f4cc46ca8 h1:GoUxHONo2E9L3pAhPj9FLSEteJYjZKZVHiYudj0uunE=
github.com/rystaf/go-lemmy v0.0.0-20231217010740-5b1f4cc46ca8/go.mod h1:pCCcm1YH2pDzoO8MqjcwnQGoMBwRRIvqMmYZosF1lXw=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/yuin/goldmark v1.5.4 h1:2uY/xC0roWy8IBEGLgB1ywIoEJFGmRrX21YQcvGZzjU=
github.com/yuin/goldmark v1.5.4/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.elara.ws/go-lemmy v0.19.0 h1:FdPfiA+8yOa2IhrLdBp8jdYbnY6H55bfwnBbiGr0OHg=
go.elara.ws/go-lemmy v0.19.0/go.mod h1:aZbF/4c1VA7qPXsP4Pth0ERu3HGZFPPl8bTY1ltBrcQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

View file

@ -19,7 +19,7 @@ import (
"github.com/dustin/go-humanize"
"github.com/julienschmidt/httprouter"
"github.com/k3a/html2text"
"go.elara.ws/go-lemmy"
"github.com/rystaf/go-lemmy"
"golang.org/x/text/language"
"golang.org/x/text/message"
)

View file

@ -16,9 +16,8 @@ import (
"sort"
"strconv"
"strings"
"time"
"go.elara.ws/go-lemmy"
"github.com/rystaf/go-lemmy"
)
type Comment struct {
@ -45,7 +44,7 @@ type Person struct {
}
type Activity struct {
Timestamp time.Time
Timestamp lemmy.LemmyTime
Comment *Comment
Post *Post
Message *lemmy.PrivateMessageView
@ -498,7 +497,7 @@ func (state *State) GetUser(username string) {
})
}
sort.Slice(state.Activities, func(i, j int) bool {
return state.Activities[i].Timestamp.After(state.Activities[j].Timestamp)
return state.Activities[i].Timestamp.After(state.Activities[j].Timestamp.Time)
})
}

View file

@ -47,7 +47,7 @@
{{- end -}}
</a>
{{end}}
sent {{ humanize $activity.Message.PrivateMessage.Published }}
sent {{ humanize $activity.Message.PrivateMessage.Published.Time }}
</span>
<div>{{ markdown "" $activity.Message.PrivateMessage.Content }}</div>
</div>

View file

@ -28,9 +28,9 @@
{{ fullname .P.Creator }}
{{- end -}}
</a>
<b>{{.P.Counts.Score}} points</b> <span title="{{.P.Comment.Published}}">{{ humanize .P.Comment.Published }}</span>
{{- if gt .P.Comment.Updated.Unix .P.Comment.Published.Unix -}}
* (last edited <span title="{{.P.Comment.Updated}}">{{ humanize .P.Comment.Updated }}</span>)
<b>{{.P.Counts.Score}} points</b> <span title="{{.P.Comment.Published.Time}}">{{ humanize .P.Comment.Published.Time }}</span>
{{- if gt .P.Comment.Updated.ValueOrZero.Time.Unix .P.Comment.Published.Time.Unix -}}
* (last edited <span title="{{.P.Comment.Updated.ValueOrZero.Time}}">{{ humanize .P.Comment.Updated.ValueOrZero.Time }}</span>)
{{ end }}
</div>
<div class="content">

View file

@ -12,7 +12,7 @@
{{ end }}
<div class="gray">
{{ if .Counts.Subscribers }}{{ printer .Counts.Subscribers }} subscribers,{{end}}
a community founded {{ humanize .Community.Published }}
a community founded {{ humanize .Community.Published.Time }}
</div>
</div>
</div>

View file

@ -44,9 +44,9 @@
<div class="expando-button{{ if and (not (and .Post.Body.IsValid .Post.Body.String )) (not (isImage .Post.URL.String)) }} hidden{{else if eq .Rank 0}} open{{ end }}"></div>
<div class="meta">
submitted
<span title="{{.Post.Published}}">{{ humanize .Post.Published -}}</span>
{{- if gt .Post.Updated.Unix .Post.Published.Unix -}}
* (last edited <span title="{{.Post.Updated}}">{{ humanize .Post.Updated }}</span>)
<span title="{{.Post.Published.Time}}">{{ humanize .Post.Published.Time -}}</span>
{{- if gt .Post.Updated.ValueOrZero.Time.Unix .Post.Published.Time.Unix -}}
* (last edited <span title="{{.Post.Updated.ValueOrZero.Time}}">{{ humanize .Post.Updated.ValueOrZero.Time }}</span>)
{{ end }}
by
<a class="submitter{{ if false}} admin{{end}}" href="/{{ .State.Host }}/u/{{ fullname .Creator }}">

View file

@ -33,7 +33,7 @@
{{ end }}
<div class="age">
{{ if .Session }}<span class="left"><a href="/{{ $host}}/u/{{ fullname .User.PersonView.Person }}/message">send a message</a></span>{{end}}
<span title="{{ .User.PersonView.Person.Published}}">joined {{ humanize .User.PersonView.Person.Published }}</span>
<span title="{{ .User.PersonView.Person.Published.Time}}">joined {{ humanize .User.PersonView.Person.Published.Time }}</span>
</div>
{{ if .User.Moderates }}
MODERATOR OF
@ -47,7 +47,7 @@
{{ if and .PostID .Posts }}
<div class="stats">
this post was submitted on {{ (index .Posts 0).Post.Published.Format "02 Jan 2006" }}
this post was submitted on {{ (index .Posts 0).Post.Published.Time.Format "02 Jan 2006" }}
<div><b><span>{{ (index .Posts 0).Counts.Score }}</span> points</b> ({{likedPerc (index .Posts 0).Counts}}% liked)</div>
</div>
{{ end }}
@ -72,7 +72,7 @@
<span class="green" title="Users active in the last day"></span>
{{ printer .Site.SiteView.Counts.UsersActiveDay }} users here now
{{ markdown .Host .Site.SiteView.Site.Sidebar.String }}
<div class="age" title="{{ .Site.SiteView.Site.Published}}">founded {{ humanize .Site.SiteView.Site.Published }}</div>
<div class="age" title="{{ .Site.SiteView.Site.Published.Time}}">founded {{ humanize .Site.SiteView.Site.Published.Time }}</div>
{{ if .Site.Admins }}
ADMINS
<div class="moderators">
@ -110,8 +110,8 @@
<p class="gray">you are a moderator of this community</p>
{{ end }}
<p>{{ markdown .Host .Community.CommunityView.Community.Description.String }}</p>
<div class="age" title="{{ .Community.CommunityView.Counts.Published}}">
founded {{ humanize .Community.CommunityView.Counts.Published }}
<div class="age" title="{{ .Community.CommunityView.Counts.Published.Time}}">
founded {{ humanize .Community.CommunityView.Counts.Published.Time }}
</div>
{{ if and .Session (isMod .Community .Session.UserName) }}
MODERATOR TOOLS