mirror of
https://github.com/rystaf/mlmym.git
synced 2024-11-25 14:49:07 +00:00
other discussions link. fixes #74
This commit is contained in:
parent
4a862b4e03
commit
4483159c2f
14
state.go
14
state.go
|
@ -55,6 +55,7 @@ type Post struct {
|
||||||
lemmy.PostView
|
lemmy.PostView
|
||||||
Rank int
|
Rank int
|
||||||
State *State
|
State *State
|
||||||
|
CrossPosts int
|
||||||
}
|
}
|
||||||
|
|
||||||
type Session struct {
|
type Session struct {
|
||||||
|
@ -666,10 +667,19 @@ func (state *State) GetPost(postid int64) {
|
||||||
state.Error = err
|
state.Error = err
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
state.Posts = []Post{Post{
|
post := Post{
|
||||||
PostView: resp.PostView,
|
PostView: resp.PostView,
|
||||||
State: state,
|
State: state,
|
||||||
}}
|
CrossPosts: len(resp.CrossPosts),
|
||||||
|
}
|
||||||
|
if state.Listing == "Local" && post.Post.Local {
|
||||||
|
for _, p := range resp.CrossPosts {
|
||||||
|
if !p.Post.Local {
|
||||||
|
post.CrossPosts--
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
state.Posts = []Post{post}
|
||||||
if state.CommentID > 0 && len(state.Posts) > 0 {
|
if state.CommentID > 0 && len(state.Posts) > 0 {
|
||||||
state.Posts[0].Rank = -1
|
state.Posts[0].Rank = -1
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,10 @@
|
||||||
<li id="showimages"><a id="se" href="">show images</a></li>
|
<li id="showimages"><a id="se" href="">show images</a></li>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if and .PostID }}{{ $post := (index .Posts 0) }}{{ if $post.CrossPosts }}
|
||||||
|
<li><a href="/{{.Host}}/search?q={{ $post.Post.URL.String }}&searchtype=Url{{ if not $post.Post.Local }}&listingType=All{{end}}">other discussions ({{ $post.CrossPosts }})</a></li>
|
||||||
|
{{ end }}{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</nav>
|
</nav>
|
||||||
|
|
Loading…
Reference in a new issue