Skip to content

Commit 7be16c6

Browse files
author
Christopher Brown
committed
more link polish: fix comment context links for mobile, use permalink url when possible
1 parent 535f843 commit 7be16c6

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

server/index_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ var index = `<!DOCTYPE html><html>
6363
</footer>
6464
</div>
6565
66-
<script src="static/index.js?v2"></script>
66+
<script src="static/index.js?v3"></script>
6767
</body>
6868
</html>`
6969

server/reddit_comment.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,7 @@ func (c *RedditComment) ActivityKey() uint32 {
2727
func (c *RedditComment) PostURL() string {
2828
return fmt.Sprintf("https://www.reddit.com/r/pathofexile/comments/%v/", c.PostId)
2929
}
30+
31+
func (c *RedditComment) CommentURL() string {
32+
return fmt.Sprintf("https://www.reddit.com/r/pathofexile/comments/%v/-/%v/?context=3", c.PostId, c.Id)
33+
}

server/rss_handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func RSSHandler(db *Database) echo.HandlerFunc {
5454
comment := a.(*RedditComment)
5555
response.Items = append(response.Items, rssItem{
5656
Title: comment.Author + " - " + comment.PostTitle,
57-
Link: comment.PostURL(),
57+
Link: comment.CommentURL(),
5858
GUID: "reddit-comment-" + comment.Id,
5959
Description: comment.BodyHTML,
6060
PubDate: comment.Time.Format(time.RFC1123Z),

server/static/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,12 @@ function loadActivity() {
4444
));
4545
} else if (type == "reddit_post") {
4646
$tr.append($('<td class="title">').append($('<a>')
47-
.attr('href', activity.url ? activity.url : ('https://www.reddit.com/r/pathofexile/comments/' + activity.post_id))
47+
.attr('href', activity.url ? activity.url : ('https://www.reddit.com' + activity.permalink))
4848
.text(activity.title)
4949
));
5050
} else if (type == "reddit_comment") {
5151
$tr.append($('<td class="title">').append($('<a>')
52-
.attr('href', 'https://www.reddit.com/r/pathofexile/comments/' + activity.post_id + '//' + activity.id + '/?context=3')
52+
.attr('href', 'https://www.reddit.com/r/pathofexile/comments/' + activity.post_id + '/-/' + activity.id + '/?context=3')
5353
.text(activity.post_title)
5454
));
5555
}

0 commit comments

Comments
 (0)