Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Submission::link and Comment::comment_link #82

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/redd/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ class Comment < Model
# @return [Boolean] whether the comment is distinguished
property :distinguished?, from: :distinguished

# @return [String] the url to this specific comment
def comment_url
link.link + id
end

private

def lazer_reload
Expand Down
5 changes: 5 additions & 0 deletions lib/redd/models/submission.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ def set_suggested_sort(suggested) # rubocop:disable Naming/AccessorMethodName
client.post('/api/set_suggested_sort', id: read_attribute(:name), sort: suggested)
end

# @return [String] the **absolute** url to the submission
def url
"https://www.reddit.com#{permalink}"
end

# @!attribute [r] sort_order
# @return [Symbol] the comment sort order
property :sort_order, :nil
Expand Down