Add tests for More and Random methods

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian 2020-07-20 22:47:59 -04:00
parent 465e96353c
commit eb79c4b53e
5 changed files with 932 additions and 18 deletions

16
post.go
View file

@ -435,7 +435,7 @@ func (s *PostService) DisableContestMode(ctx context.Context, id string) (*Respo
// commentIDs are the ID36s of comments.
func (s *PostService) More(ctx context.Context, comment *Comment) (*Response, error) {
if comment == nil {
return nil, errors.New("comment: cannot be nil")
return nil, errors.New("comment: must not be nil")
}
if comment.Replies.MoreComments == nil {
@ -502,9 +502,7 @@ func addCommentToReplies(parent *Comment, comment *Comment) {
}
}
// RandomFromSubreddits returns a random post and its comments from the subreddits.
// If no subreddits are provided, it will run the query against your subscriptions.
func (s *PostService) RandomFromSubreddits(ctx context.Context, subreddits ...string) (*Post, []*Comment, *Response, error) {
func (s *PostService) random(ctx context.Context, subreddits ...string) (*Post, []*Comment, *Response, error) {
path := "random"
if len(subreddits) > 0 {
path = fmt.Sprintf("r/%s/random", strings.Join(subreddits, "+"))
@ -524,12 +522,18 @@ func (s *PostService) RandomFromSubreddits(ctx context.Context, subreddits ...st
return root.Post, root.Comments, resp, nil
}
// RandomFromSubreddits returns a random post and its comments from the subreddits.
// If no subreddits are provided, Reddit runs the query against your subscriptions.
func (s *PostService) RandomFromSubreddits(ctx context.Context, subreddits ...string) (*Post, []*Comment, *Response, error) {
return s.random(ctx, subreddits...)
}
// Random returns a random post and its comments from all of Reddit.
func (s *PostService) Random(ctx context.Context) (*Post, []*Comment, *Response, error) {
return s.RandomFromSubreddits(ctx, "all")
return s.random(ctx, "all")
}
// RandomFromSubscriptions returns a random post and its comments from your subscriptions.
func (s *PostService) RandomFromSubscriptions(ctx context.Context) (*Post, []*Comment, *Response, error) {
return s.RandomFromSubreddits(ctx)
return s.random(ctx)
}

View file

@ -1,28 +1,115 @@
package reddit
import (
"fmt"
"net/http"
"net/url"
"testing"
"time"
"github.com/stretchr/testify/assert"
)
// func TestPostService_Get(t *testing.T) {
// setup()
// defer teardown()
var expectedPost2 = &Post{
ID: "testpost",
FullID: "t3_testpost",
Created: &Timestamp{time.Date(2020, 7, 18, 10, 26, 7, 0, time.UTC)},
Edited: &Timestamp{time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC)},
// blob := readFileContents(t, "testdata/post/post.json")
Permalink: Permalink("https://www.reddit.com/r/test/comments/testpost/test/"),
URL: "https://www.reddit.com/r/test/comments/testpost/test/",
// mux.HandleFunc("/comments/test", func(w http.ResponseWriter, r *http.Request) {
// assert.Equal(t, http.MethodGet, r.Method)
// fmt.Fprint(w, blob)
// })
Title: "Test",
Body: "Hello",
// post, comments, _, err := client.Post.Get(ctx, "test")
// assert.NoError(t, err)
// assert.Equal(t, http.StatusOK, res.StatusCode)
// }
Score: 1,
UpvoteRatio: 1,
NumberOfComments: 2,
SubredditID: "t5_2qh23",
SubredditName: "test",
SubredditNamePrefixed: "r/test",
AuthorID: "t2_testuser",
AuthorName: "testuser",
IsSelfPost: true,
}
var expectedComments = []*Comment{
{
ID: "testc1",
FullID: "t1_testc1",
Created: &Timestamp{time.Date(2020, 7, 18, 10, 31, 59, 0, time.UTC)},
Edited: &Timestamp{time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC)},
ParentID: "t3_testpost",
Permalink: Permalink("https://www.reddit.com/r/test/comments/testpost/test/testc1/"),
Body: "Hi",
Author: "testuser",
AuthorID: "t2_testuser",
Subreddit: "test",
SubredditNamePrefixed: "r/test",
SubredditID: "t5_2qh23",
Score: 1,
Controversiality: 0,
PostID: "t3_testpost",
IsSubmitter: true,
CanGild: true,
Replies: Replies{
Comments: []*Comment{
{
ID: "testc2",
FullID: "t1_testc2",
Created: &Timestamp{time.Date(2020, 7, 18, 10, 32, 28, 0, time.UTC)},
Edited: &Timestamp{time.Date(1, 1, 1, 0, 0, 0, 0, time.UTC)},
ParentID: "t1_testc1",
Permalink: Permalink("https://www.reddit.com/r/test/comments/testpost/test/testc2/"),
Body: "Hello",
Author: "testuser",
AuthorID: "t2_testuser",
Subreddit: "test",
SubredditNamePrefixed: "r/test",
SubredditID: "t5_2qh23",
Score: 1,
Controversiality: 0,
PostID: "t3_testpost",
IsSubmitter: true,
CanGild: true,
},
},
},
},
}
func TestPostService_Get(t *testing.T) {
setup()
defer teardown()
blob := readFileContents(t, "testdata/post/post.json")
mux.HandleFunc("/comments/test", func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodGet, r.Method)
fmt.Fprint(w, blob)
})
post, comments, _, err := client.Post.Get(ctx, "test")
assert.NoError(t, err)
assert.Equal(t, expectedPost2, post)
assert.Equal(t, expectedComments, comments)
}
func TestPostService_Hide(t *testing.T) {
setup()
@ -482,3 +569,121 @@ func TestPostService_DisableContestMode(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, http.StatusOK, res.StatusCode)
}
func TestPostService_More(t *testing.T) {
setup()
defer teardown()
parentComment := &Comment{
FullID: "t1_abc",
ParentID: "t3_123",
PostID: "t3_123",
Replies: Replies{
MoreComments: &More{
Children: []string{"def,ghi"},
},
},
}
blob := readFileContents(t, "testdata/post/more.json")
mux.HandleFunc("/api/morechildren", func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodGet, r.Method)
form := url.Values{}
form.Set("link_id", "t3_123")
form.Set("children", "def,ghi")
form.Set("api_type", "json")
err := r.ParseForm()
assert.NoError(t, err)
assert.Equal(t, form, r.Form)
fmt.Fprint(w, blob)
})
_, err := client.Post.More(ctx, parentComment)
assert.NoError(t, err)
assert.Nil(t, parentComment.Replies.MoreComments)
assert.Len(t, parentComment.Replies.Comments, 1)
assert.Len(t, parentComment.Replies.Comments[0].Replies.Comments, 1)
}
func TestPostService_MoreNil(t *testing.T) {
setup()
defer teardown()
_, err := client.Post.More(ctx, nil)
assert.EqualError(t, err, "comment: must not be nil")
parentComment := &Comment{
Replies: Replies{
MoreComments: nil,
},
}
// should return nil, nil since comment does not have More struct
resp, err := client.Post.More(ctx, parentComment)
assert.NoError(t, err)
assert.Nil(t, resp)
parentComment.Replies.MoreComments = &More{
Children: []string{},
}
// should return nil, nil since comment's More struct has 0 children
resp, err = client.Post.More(ctx, parentComment)
assert.NoError(t, err)
assert.Nil(t, resp)
}
func TestPostService_RandomFromSubreddits(t *testing.T) {
setup()
defer teardown()
blob := readFileContents(t, "testdata/post/post.json")
mux.HandleFunc("/r/test/random", func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodGet, r.Method)
fmt.Fprint(w, blob)
})
post, comments, _, err := client.Post.RandomFromSubreddits(ctx, "test")
assert.NoError(t, err)
assert.Equal(t, expectedPost2, post)
assert.Equal(t, expectedComments, comments)
}
func TestPostService_Random(t *testing.T) {
setup()
defer teardown()
blob := readFileContents(t, "testdata/post/post.json")
mux.HandleFunc("/r/all/random", func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodGet, r.Method)
fmt.Fprint(w, blob)
})
post, comments, _, err := client.Post.Random(ctx)
assert.NoError(t, err)
assert.Equal(t, expectedPost2, post)
assert.Equal(t, expectedComments, comments)
}
func TestPostService_RandomFromSubscriptions(t *testing.T) {
setup()
defer teardown()
blob := readFileContents(t, "testdata/post/post.json")
mux.HandleFunc("/random", func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodGet, r.Method)
fmt.Fprint(w, blob)
})
post, comments, _, err := client.Post.RandomFromSubscriptions(ctx)
assert.NoError(t, err)
assert.Equal(t, expectedPost2, post)
assert.Equal(t, expectedComments, comments)
}

View file

@ -118,6 +118,20 @@ var expectedModerators = []Moderator{
{ID: "t2_test2", Name: "testuser2", Permissions: []string{"all"}},
}
var expectedRandomSubreddit = &Subreddit{
FullID: "t5_2wi4l",
Created: &Timestamp{time.Date(2013, 3, 1, 4, 4, 18, 0, time.UTC)},
URL: "/r/GalaxyS8/",
Name: "GalaxyS8",
NamePrefixed: "r/GalaxyS8",
Title: "Samsung Galaxy S8",
Description: "The only place for news, discussion, photos, and everything else Samsung Galaxy S8.",
Type: "public",
Subscribers: 52357,
}
func TestSubredditService_GetByName(t *testing.T) {
setup()
defer teardown()
@ -285,3 +299,47 @@ func TestSubredditService_Moderators(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, expectedModerators, moderators)
}
func TestSubredditService_Random(t *testing.T) {
setup()
defer teardown()
blob := readFileContents(t, "testdata/subreddit/random.json")
mux.HandleFunc("/r/random", func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodGet, r.Method)
err := r.ParseForm()
assert.NoError(t, err)
assert.Equal(t, "true", r.Form.Get("sr_detail"))
assert.Equal(t, "1", r.Form.Get("limit"))
fmt.Fprint(w, blob)
})
subreddit, _, err := client.Subreddit.Random(ctx)
assert.NoError(t, err)
assert.Equal(t, expectedRandomSubreddit, subreddit)
}
func TestSubredditService_RandomNSFW(t *testing.T) {
setup()
defer teardown()
blob := readFileContents(t, "testdata/subreddit/random.json")
mux.HandleFunc("/r/randnsfw", func(w http.ResponseWriter, r *http.Request) {
assert.Equal(t, http.MethodGet, r.Method)
err := r.ParseForm()
assert.NoError(t, err)
assert.Equal(t, "true", r.Form.Get("sr_detail"))
assert.Equal(t, "1", r.Form.Get("limit"))
fmt.Fprint(w, blob)
})
subreddit, _, err := client.Subreddit.RandomNSFW(ctx)
assert.NoError(t, err)
assert.Equal(t, expectedRandomSubreddit, subreddit)
}

151
testdata/post/more.json vendored Normal file
View file

@ -0,0 +1,151 @@
{
"json": {
"errors": [],
"data": {
"things": [
{
"kind": "t1",
"data": {
"total_awards_received": 0,
"approved_at_utc": null,
"edited": false,
"mod_reason_by": null,
"banned_by": null,
"author_flair_type": "text",
"removal_reason": null,
"link_id": "t3_123",
"author_flair_template_id": null,
"likes": null,
"replies": "",
"user_reports": [],
"saved": false,
"id": "def",
"banned_at_utc": null,
"mod_reason_title": null,
"gilded": 0,
"archived": false,
"no_follow": false,
"author": "testuser1",
"can_mod_post": false,
"send_replies": true,
"parent_id": "t1_abc",
"score": 5,
"author_fullname": "t2_user1",
"approved_by": null,
"mod_note": null,
"all_awardings": [],
"subreddit_id": "t5_2qh1i",
"body": "Wow, I came here to say exactly this and figured it would be buried. Pleasantly shocked to see your comment as the top comment! So. Good. Thanks, random internet friend!",
"awarders": [],
"downs": 0,
"author_flair_css_class": null,
"name": "t1_def",
"author_patreon_flair": false,
"collapsed": false,
"author_flair_richtext": [],
"is_submitter": false,
"body_html": "&lt;div class=\"md\"&gt;&lt;p&gt;Wow, I came here to say exactly this and figured it would be buried. Pleasantly shocked to see your comment as the top comment! So. Good. Thanks, random internet friend!&lt;/p&gt;\n&lt;/div&gt;",
"gildings": {},
"collapsed_reason": null,
"distinguished": null,
"associated_award": null,
"stickied": false,
"author_premium": false,
"can_gild": true,
"top_awarded_type": null,
"author_flair_text_color": null,
"score_hidden": false,
"permalink": "/r/AskReddit/comments/123/which_scene_from_an_animated_film_will_always_be/def/",
"num_reports": null,
"locked": false,
"report_reasons": null,
"created": 1595301409.0,
"subreddit": "AskReddit",
"author_flair_text": null,
"treatment_tags": [],
"created_utc": 1595272609.0,
"subreddit_name_prefixed": "r/AskReddit",
"controversiality": 0,
"depth": 1,
"author_flair_background_color": null,
"collapsed_because_crowd_control": null,
"mod_reports": [],
"subreddit_type": "public",
"ups": 5
}
},
{
"kind": "t1",
"data": {
"total_awards_received": 0,
"approved_at_utc": null,
"edited": false,
"mod_reason_by": null,
"banned_by": null,
"author_flair_type": "text",
"removal_reason": null,
"link_id": "t3_123",
"author_flair_template_id": null,
"likes": null,
"replies": "",
"user_reports": [],
"saved": false,
"id": "ghi",
"banned_at_utc": null,
"mod_reason_title": null,
"gilded": 0,
"archived": false,
"no_follow": true,
"author": "testuser2",
"can_mod_post": false,
"send_replies": true,
"parent_id": "t1_def",
"score": 1,
"author_fullname": "t2_user2",
"approved_by": null,
"mod_note": null,
"all_awardings": [],
"subreddit_id": "t5_2qh1i",
"body": "Oh my god yes best movie ever love that scene",
"awarders": [],
"downs": 0,
"author_flair_css_class": null,
"name": "t1_ghi",
"author_patreon_flair": false,
"collapsed": false,
"author_flair_richtext": [],
"is_submitter": false,
"body_html": "&lt;div class=\"md\"&gt;&lt;p&gt;Oh my god yes best movie ever love that scene&lt;/p&gt;\n&lt;/div&gt;",
"gildings": {},
"collapsed_reason": null,
"distinguished": null,
"associated_award": null,
"stickied": false,
"author_premium": false,
"can_gild": true,
"top_awarded_type": null,
"author_flair_text_color": null,
"score_hidden": false,
"permalink": "/r/AskReddit/comments/123/which_scene_from_an_animated_film_will_always_be/ghi/",
"num_reports": null,
"locked": false,
"report_reasons": null,
"created": 1595308578.0,
"subreddit": "AskReddit",
"author_flair_text": null,
"treatment_tags": [],
"created_utc": 1595279778.0,
"subreddit_name_prefixed": "r/AskReddit",
"controversiality": 0,
"depth": 1,
"author_flair_background_color": null,
"collapsed_because_crowd_control": null,
"mod_reports": [],
"subreddit_type": "public",
"ups": 1
}
}
]
}
}
}

496
testdata/subreddit/random.json vendored Normal file
View file

@ -0,0 +1,496 @@
{
"kind": "Listing",
"data": {
"modhash": null,
"dist": 3,
"children": [
{
"kind": "t3",
"data": {
"approved_at_utc": null,
"subreddit": "GalaxyS8",
"selftext": "Post the best photos you have taken this week!\n\nIf you would like to see more, visit /r/GalaxyPhotography and /r/MobilePhotography.\n*****\n*If you have any suggestions for weekly posts, please feel free to message the moderators!*",
"author_fullname": "t2_6l4z3",
"saved": false,
"mod_reason_title": null,
"gilded": 0,
"clicked": false,
"title": "Weekly Photography Thread - July 14, 2020",
"link_flair_richtext": [],
"subreddit_name_prefixed": "r/GalaxyS8",
"hidden": false,
"pwls": 6,
"link_flair_css_class": "creative",
"downs": 0,
"thumbnail_height": null,
"top_awarded_type": null,
"hide_score": false,
"name": "t3_href69",
"quarantine": false,
"link_flair_text_color": "dark",
"upvote_ratio": 1.0,
"author_flair_background_color": null,
"subreddit_type": "public",
"ups": 1,
"total_awards_received": 0,
"media_embed": {},
"thumbnail_width": null,
"author_flair_template_id": null,
"is_original_content": false,
"user_reports": [],
"secure_media": null,
"is_reddit_media_domain": false,
"is_meta": false,
"category": null,
"secure_media_embed": {},
"link_flair_text": "Creative",
"can_mod_post": false,
"score": 1,
"approved_by": null,
"author_premium": true,
"thumbnail": "self",
"edited": false,
"author_flair_css_class": null,
"author_flair_richtext": [],
"gildings": {},
"content_categories": null,
"is_self": true,
"mod_note": null,
"created": 1594805358.0,
"link_flair_type": "text",
"wls": 6,
"removed_by_category": null,
"banned_by": null,
"author_flair_type": "text",
"domain": "self.GalaxyS8",
"allow_live_comments": false,
"selftext_html": "&lt;!-- SC_OFF --&gt;&lt;div class=\"md\"&gt;&lt;p&gt;Post the best photos you have taken this week!&lt;/p&gt;\n\n&lt;p&gt;If you would like to see more, visit &lt;a href=\"/r/GalaxyPhotography\"&gt;/r/GalaxyPhotography&lt;/a&gt; and &lt;a href=\"/r/MobilePhotography\"&gt;/r/MobilePhotography&lt;/a&gt;.&lt;/p&gt;\n\n&lt;hr/&gt;\n\n&lt;p&gt;&lt;em&gt;If you have any suggestions for weekly posts, please feel free to message the moderators!&lt;/em&gt;&lt;/p&gt;\n&lt;/div&gt;&lt;!-- SC_ON --&gt;",
"likes": null,
"suggested_sort": null,
"banned_at_utc": null,
"view_count": null,
"archived": false,
"no_follow": true,
"is_crosspostable": true,
"pinned": false,
"over_18": false,
"all_awardings": [],
"awarders": [],
"media_only": false,
"sr_detail": {
"default_set": true,
"banner_img": "",
"restrict_posting": true,
"user_is_banned": false,
"free_form_reports": true,
"community_icon": null,
"show_media": true,
"description": "### Rules\n\n* Posts and comments must be relevant to the Galaxy S8.\n* Do not post any referral codes.\n* No trolling.\n* No buying/selling/trading.\n* Do not editorialize submission titles.\n* No spamming or blog-spam.\n* Any photos/videos taken with the S8 should be posted in the weekly photography thread.\n\n### Link flair must be used\n\n* News\n* Rumor\n* Discussion\n* Help\n* Tricks\n* Creative\n* Other\n\nFlair can also be added by putting it in brackets before the post title, for example:\n&gt; [Help] I need help\n\n### Related Subreddits\n\n* [Samsung](https://www.reddit.com/r/Samsung)\n* [Galaxy Photography](https://www.reddit.com/r/galaxyphotography)\n* [Amoled Backgrounds](https://www.reddit.com/r/Amoledbackgrounds)\n\n### Discord Server\n\n* [Click Here to Join](https://discord.gg/4uxusu8)",
"user_is_muted": false,
"display_name": "GalaxyS8",
"header_img": "https://b.thumbs.redditmedia.com/AfySt3BMPjuq79LOh84X4uomahu0JE8DLaJZMenG-5I.png",
"title": "Samsung Galaxy S8",
"previous_names": [],
"user_is_moderator": false,
"over_18": false,
"icon_size": [256, 256],
"primary_color": "#373c3f",
"icon_img": "https://b.thumbs.redditmedia.com/4hg41g2_X1R5S_HTUscWCK_7iAo6SPdag_oOlSx7WAM.png",
"icon_color": "",
"is_chat_post_feature_enabled": true,
"submit_link_label": null,
"header_size": [1, 1],
"restrict_commenting": false,
"subscribers": 52357,
"submit_text_label": null,
"link_flair_position": "left",
"display_name_prefixed": "r/GalaxyS8",
"key_color": "",
"name": "t5_2wi4l",
"created": 1362139458.0,
"url": "/r/GalaxyS8/",
"created_utc": 1362110658.0,
"banner_size": null,
"allow_chat_post_creation": false,
"user_is_contributor": false,
"public_description": "The only place for news, discussion, photos, and everything else Samsung Galaxy S8.",
"link_flair_enabled": true,
"disable_contributor_requests": false,
"subreddit_type": "public",
"user_is_subscriber": false
},
"can_gild": true,
"spoiler": false,
"locked": false,
"author_flair_text": null,
"treatment_tags": [],
"visited": false,
"removed_by": null,
"num_reports": null,
"distinguished": "moderator",
"subreddit_id": "t5_2wi4l",
"mod_reason_by": null,
"removal_reason": null,
"link_flair_background_color": "",
"id": "href69",
"is_robot_indexable": true,
"report_reasons": null,
"author": "AutoModerator",
"discussion_type": null,
"num_comments": 0,
"send_replies": false,
"whitelist_status": "all_ads",
"contest_mode": false,
"mod_reports": [],
"author_patreon_flair": false,
"author_flair_text_color": null,
"permalink": "/r/GalaxyS8/comments/href69/weekly_photography_thread_july_14_2020/",
"parent_whitelist_status": "all_ads",
"stickied": true,
"url": "https://www.reddit.com/r/GalaxyS8/comments/href69/weekly_photography_thread_july_14_2020/",
"subreddit_subscribers": 52357,
"created_utc": 1594776558.0,
"num_crossposts": 0,
"media": null,
"is_video": false
}
},
{
"kind": "t3",
"data": {
"approved_at_utc": null,
"subreddit": "GalaxyS8",
"selftext": "This thread is for sharing the customizations you have made to your S8, both externally and to the software. So if you're trying \nout a new home screen layout, just got a new case, or installed a new ROM, this is the place to show it off!\n\nAs usual, be polite to other users, and don't downvote screenshots you don't like.\n\n**If you're posting a home screen layout, please include as much information as possible. This includes icon packs, widgets, launchers, etc.**\n*****\n*If you have any suggestions for weekly posts, please feel free to message the moderators!*",
"author_fullname": "t2_6l4z3",
"saved": false,
"mod_reason_title": null,
"gilded": 0,
"clicked": false,
"title": "Weekly Customization Thread - July 14, 2020",
"link_flair_richtext": [],
"subreddit_name_prefixed": "r/GalaxyS8",
"hidden": false,
"pwls": 6,
"link_flair_css_class": "creative",
"downs": 0,
"thumbnail_height": null,
"top_awarded_type": null,
"hide_score": false,
"name": "t3_href9f",
"quarantine": false,
"link_flair_text_color": "dark",
"upvote_ratio": 0.8,
"author_flair_background_color": null,
"subreddit_type": "public",
"ups": 12,
"total_awards_received": 0,
"media_embed": {},
"thumbnail_width": null,
"author_flair_template_id": null,
"is_original_content": false,
"user_reports": [],
"secure_media": null,
"is_reddit_media_domain": false,
"is_meta": false,
"category": null,
"secure_media_embed": {},
"link_flair_text": "Creative",
"can_mod_post": false,
"score": 12,
"approved_by": null,
"author_premium": true,
"thumbnail": "self",
"edited": false,
"author_flair_css_class": null,
"author_flair_richtext": [],
"gildings": {},
"content_categories": null,
"is_self": true,
"mod_note": null,
"created": 1594805367.0,
"link_flair_type": "text",
"wls": 6,
"removed_by_category": null,
"banned_by": null,
"author_flair_type": "text",
"domain": "self.GalaxyS8",
"allow_live_comments": false,
"selftext_html": "&lt;!-- SC_OFF --&gt;&lt;div class=\"md\"&gt;&lt;p&gt;This thread is for sharing the customizations you have made to your S8, both externally and to the software. So if you&amp;#39;re trying \nout a new home screen layout, just got a new case, or installed a new ROM, this is the place to show it off!&lt;/p&gt;\n\n&lt;p&gt;As usual, be polite to other users, and don&amp;#39;t downvote screenshots you don&amp;#39;t like.&lt;/p&gt;\n\n&lt;p&gt;&lt;strong&gt;If you&amp;#39;re posting a home screen layout, please include as much information as possible. This includes icon packs, widgets, launchers, etc.&lt;/strong&gt;&lt;/p&gt;\n\n&lt;hr/&gt;\n\n&lt;p&gt;&lt;em&gt;If you have any suggestions for weekly posts, please feel free to message the moderators!&lt;/em&gt;&lt;/p&gt;\n&lt;/div&gt;&lt;!-- SC_ON --&gt;",
"likes": null,
"suggested_sort": null,
"banned_at_utc": null,
"view_count": null,
"archived": false,
"no_follow": true,
"is_crosspostable": true,
"pinned": false,
"over_18": false,
"all_awardings": [],
"awarders": [],
"media_only": false,
"sr_detail": {
"default_set": true,
"banner_img": "",
"restrict_posting": true,
"user_is_banned": false,
"free_form_reports": true,
"community_icon": null,
"show_media": true,
"description": "### Rules\n\n* Posts and comments must be relevant to the Galaxy S8.\n* Do not post any referral codes.\n* No trolling.\n* No buying/selling/trading.\n* Do not editorialize submission titles.\n* No spamming or blog-spam.\n* Any photos/videos taken with the S8 should be posted in the weekly photography thread.\n\n### Link flair must be used\n\n* News\n* Rumor\n* Discussion\n* Help\n* Tricks\n* Creative\n* Other\n\nFlair can also be added by putting it in brackets before the post title, for example:\n&gt; [Help] I need help\n\n### Related Subreddits\n\n* [Samsung](https://www.reddit.com/r/Samsung)\n* [Galaxy Photography](https://www.reddit.com/r/galaxyphotography)\n* [Amoled Backgrounds](https://www.reddit.com/r/Amoledbackgrounds)\n\n### Discord Server\n\n* [Click Here to Join](https://discord.gg/4uxusu8)",
"user_is_muted": false,
"display_name": "GalaxyS8",
"header_img": "https://b.thumbs.redditmedia.com/AfySt3BMPjuq79LOh84X4uomahu0JE8DLaJZMenG-5I.png",
"title": "Samsung Galaxy S8",
"previous_names": [],
"user_is_moderator": false,
"over_18": false,
"icon_size": [256, 256],
"primary_color": "#373c3f",
"icon_img": "https://b.thumbs.redditmedia.com/4hg41g2_X1R5S_HTUscWCK_7iAo6SPdag_oOlSx7WAM.png",
"icon_color": "",
"is_chat_post_feature_enabled": true,
"submit_link_label": null,
"header_size": [1, 1],
"restrict_commenting": false,
"subscribers": 52357,
"submit_text_label": null,
"link_flair_position": "left",
"display_name_prefixed": "r/GalaxyS8",
"key_color": "",
"name": "t5_2wi4l",
"created": 1362139458.0,
"url": "/r/GalaxyS8/",
"created_utc": 1362110658.0,
"banner_size": null,
"allow_chat_post_creation": false,
"user_is_contributor": false,
"public_description": "The only place for news, discussion, photos, and everything else Samsung Galaxy S8.",
"link_flair_enabled": true,
"disable_contributor_requests": false,
"subreddit_type": "public",
"user_is_subscriber": false
},
"can_gild": true,
"spoiler": false,
"locked": false,
"author_flair_text": null,
"treatment_tags": [],
"visited": false,
"removed_by": null,
"num_reports": null,
"distinguished": "moderator",
"subreddit_id": "t5_2wi4l",
"mod_reason_by": null,
"removal_reason": null,
"link_flair_background_color": "",
"id": "href9f",
"is_robot_indexable": true,
"report_reasons": null,
"author": "AutoModerator",
"discussion_type": null,
"num_comments": 0,
"send_replies": false,
"whitelist_status": "all_ads",
"contest_mode": false,
"mod_reports": [],
"author_patreon_flair": false,
"author_flair_text_color": null,
"permalink": "/r/GalaxyS8/comments/href9f/weekly_customization_thread_july_14_2020/",
"parent_whitelist_status": "all_ads",
"stickied": true,
"url": "https://www.reddit.com/r/GalaxyS8/comments/href9f/weekly_customization_thread_july_14_2020/",
"subreddit_subscribers": 52357,
"created_utc": 1594776567.0,
"num_crossposts": 0,
"media": null,
"is_video": false
}
},
{
"kind": "t3",
"data": {
"approved_at_utc": null,
"subreddit": "GalaxyS8",
"selftext": "Has anyone seen a glass screen protector that is edge to edge and only has a hole for the speaker and nothing else? \nI've looked through many listings but all I can see are glass protectors that have the cutout at the top or have holes for the speakers and camera too. \n\nIt looks like this but this one is PET: https://www.screenhug.co.nz/products/samsung-galaxy-s8-nano-film-screen-protector?variant=29245065592874&amp;utm_campaign=gs-2020-03-13&amp;utm_source=google&amp;utm_medium=smart_campaign&amp;gclid=CjwKCAjwgdX4BRB_EiwAg8O8Hah74XfBkNAwHFTQ6PqdjIVzn18nyqJMKvx-oQcY6MHm42tSfvS3NRoC3-wQAvD_BwE\n\nThanks!",
"author_fullname": "t2_fogvw",
"saved": false,
"mod_reason_title": null,
"gilded": 0,
"clicked": false,
"title": "Looking for a certain glass screen protector",
"link_flair_richtext": [],
"subreddit_name_prefixed": "r/GalaxyS8",
"hidden": false,
"pwls": 6,
"link_flair_css_class": null,
"downs": 0,
"thumbnail_height": null,
"top_awarded_type": null,
"hide_score": false,
"name": "t3_huv6o6",
"quarantine": false,
"link_flair_text_color": "dark",
"upvote_ratio": 0.72,
"author_flair_background_color": null,
"subreddit_type": "public",
"ups": 3,
"total_awards_received": 0,
"media_embed": {},
"thumbnail_width": null,
"author_flair_template_id": null,
"is_original_content": false,
"user_reports": [],
"secure_media": null,
"is_reddit_media_domain": false,
"is_meta": false,
"category": null,
"secure_media_embed": {},
"link_flair_text": null,
"can_mod_post": false,
"score": 3,
"approved_by": null,
"author_premium": false,
"thumbnail": "self",
"edited": false,
"author_flair_css_class": null,
"author_flair_richtext": [],
"gildings": {},
"post_hint": "self",
"content_categories": null,
"is_self": true,
"mod_note": null,
"created": 1595312500.0,
"link_flair_type": "text",
"wls": 6,
"removed_by_category": null,
"banned_by": null,
"author_flair_type": "text",
"domain": "self.GalaxyS8",
"allow_live_comments": false,
"selftext_html": "&lt;!-- SC_OFF --&gt;&lt;div class=\"md\"&gt;&lt;p&gt;Has anyone seen a glass screen protector that is edge to edge and only has a hole for the speaker and nothing else? \nI&amp;#39;ve looked through many listings but all I can see are glass protectors that have the cutout at the top or have holes for the speakers and camera too. &lt;/p&gt;\n\n&lt;p&gt;It looks like this but this one is PET: &lt;a href=\"https://www.screenhug.co.nz/products/samsung-galaxy-s8-nano-film-screen-protector?variant=29245065592874&amp;amp;utm_campaign=gs-2020-03-13&amp;amp;utm_source=google&amp;amp;utm_medium=smart_campaign&amp;amp;gclid=CjwKCAjwgdX4BRB_EiwAg8O8Hah74XfBkNAwHFTQ6PqdjIVzn18nyqJMKvx-oQcY6MHm42tSfvS3NRoC3-wQAvD_BwE\"&gt;https://www.screenhug.co.nz/products/samsung-galaxy-s8-nano-film-screen-protector?variant=29245065592874&amp;amp;utm_campaign=gs-2020-03-13&amp;amp;utm_source=google&amp;amp;utm_medium=smart_campaign&amp;amp;gclid=CjwKCAjwgdX4BRB_EiwAg8O8Hah74XfBkNAwHFTQ6PqdjIVzn18nyqJMKvx-oQcY6MHm42tSfvS3NRoC3-wQAvD_BwE&lt;/a&gt;&lt;/p&gt;\n\n&lt;p&gt;Thanks!&lt;/p&gt;\n&lt;/div&gt;&lt;!-- SC_ON --&gt;",
"likes": null,
"suggested_sort": null,
"banned_at_utc": null,
"view_count": null,
"archived": false,
"no_follow": true,
"is_crosspostable": true,
"pinned": false,
"over_18": false,
"preview": {
"images": [
{
"source": {
"url": "https://external-preview.redd.it/i-rbv4q7grI7-dWnwUj3pMRnw2FIy5LIKOCqfyzLVLw.jpg?auto=webp&amp;s=fd3000f004154f5c9ed0f7ef99032d85856b2d84",
"width": 600,
"height": 600
},
"resolutions": [
{
"url": "https://external-preview.redd.it/i-rbv4q7grI7-dWnwUj3pMRnw2FIy5LIKOCqfyzLVLw.jpg?width=108&amp;crop=smart&amp;auto=webp&amp;s=e2f159d19ddcd396189b776002e585a63e6ddcce",
"width": 108,
"height": 108
},
{
"url": "https://external-preview.redd.it/i-rbv4q7grI7-dWnwUj3pMRnw2FIy5LIKOCqfyzLVLw.jpg?width=216&amp;crop=smart&amp;auto=webp&amp;s=8159b558ffff87e001d2bfd9bfe29e0ea83e498c",
"width": 216,
"height": 216
},
{
"url": "https://external-preview.redd.it/i-rbv4q7grI7-dWnwUj3pMRnw2FIy5LIKOCqfyzLVLw.jpg?width=320&amp;crop=smart&amp;auto=webp&amp;s=37fdfd5338175441eff9dbd31ec5c9878b1c5c4d",
"width": 320,
"height": 320
}
],
"variants": {},
"id": "MDHMdplT-2ke-2f4u8FRXFcBjyW3SLL-c66H5dMp9yg"
}
],
"enabled": false
},
"all_awardings": [],
"awarders": [],
"media_only": false,
"sr_detail": {
"default_set": true,
"banner_img": "",
"restrict_posting": true,
"user_is_banned": false,
"free_form_reports": true,
"community_icon": null,
"show_media": true,
"description": "### Rules\n\n* Posts and comments must be relevant to the Galaxy S8.\n* Do not post any referral codes.\n* No trolling.\n* No buying/selling/trading.\n* Do not editorialize submission titles.\n* No spamming or blog-spam.\n* Any photos/videos taken with the S8 should be posted in the weekly photography thread.\n\n### Link flair must be used\n\n* News\n* Rumor\n* Discussion\n* Help\n* Tricks\n* Creative\n* Other\n\nFlair can also be added by putting it in brackets before the post title, for example:\n&gt; [Help] I need help\n\n### Related Subreddits\n\n* [Samsung](https://www.reddit.com/r/Samsung)\n* [Galaxy Photography](https://www.reddit.com/r/galaxyphotography)\n* [Amoled Backgrounds](https://www.reddit.com/r/Amoledbackgrounds)\n\n### Discord Server\n\n* [Click Here to Join](https://discord.gg/4uxusu8)",
"user_is_muted": false,
"display_name": "GalaxyS8",
"header_img": "https://b.thumbs.redditmedia.com/AfySt3BMPjuq79LOh84X4uomahu0JE8DLaJZMenG-5I.png",
"title": "Samsung Galaxy S8",
"previous_names": [],
"user_is_moderator": false,
"over_18": false,
"icon_size": [256, 256],
"primary_color": "#373c3f",
"icon_img": "https://b.thumbs.redditmedia.com/4hg41g2_X1R5S_HTUscWCK_7iAo6SPdag_oOlSx7WAM.png",
"icon_color": "",
"is_chat_post_feature_enabled": true,
"submit_link_label": null,
"header_size": [1, 1],
"restrict_commenting": false,
"subscribers": 52357,
"submit_text_label": null,
"link_flair_position": "left",
"display_name_prefixed": "r/GalaxyS8",
"key_color": "",
"name": "t5_2wi4l",
"created": 1362139458.0,
"url": "/r/GalaxyS8/",
"created_utc": 1362110658.0,
"banner_size": null,
"allow_chat_post_creation": false,
"user_is_contributor": false,
"public_description": "The only place for news, discussion, photos, and everything else Samsung Galaxy S8.",
"link_flair_enabled": true,
"disable_contributor_requests": false,
"subreddit_type": "public",
"user_is_subscriber": false
},
"can_gild": true,
"spoiler": false,
"locked": false,
"author_flair_text": null,
"treatment_tags": [],
"visited": false,
"removed_by": null,
"num_reports": null,
"distinguished": null,
"subreddit_id": "t5_2wi4l",
"mod_reason_by": null,
"removal_reason": null,
"link_flair_background_color": "",
"id": "huv6o6",
"is_robot_indexable": true,
"report_reasons": null,
"author": "imabadastronaut",
"discussion_type": null,
"num_comments": 2,
"send_replies": true,
"whitelist_status": "all_ads",
"contest_mode": false,
"mod_reports": [],
"author_patreon_flair": false,
"author_flair_text_color": null,
"permalink": "/r/GalaxyS8/comments/huv6o6/looking_for_a_certain_glass_screen_protector/",
"parent_whitelist_status": "all_ads",
"stickied": false,
"url": "https://www.reddit.com/r/GalaxyS8/comments/huv6o6/looking_for_a_certain_glass_screen_protector/",
"subreddit_subscribers": 52357,
"created_utc": 1595283700.0,
"num_crossposts": 0,
"media": null,
"is_video": false
}
}
],
"after": "t3_huv6o6",
"before": null
}
}