Skip to content

Commit f8819a0

Browse files
authored
Merge pull request #142 from justcool393/missing-permalink-fix
Fix #119.
2 parents 4ef3a50 + 81d50d3 commit f8819a0

File tree

3 files changed

+9
-26
lines changed

3 files changed

+9
-26
lines changed

RedditSharp/Things/Comment.cs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -164,25 +164,8 @@ private void ParseComments(JToken data, Thing sender)
164164
[JsonIgnore]
165165
public Thing Parent { get; internal set; }
166166

167-
/// <inheritdoc/>
168-
public override string Shortlink
169-
{
170-
get
171-
{
172-
// Not really a "short" link, but you can't actually use short links for comments
173-
string linkId = "";
174-
int index = this.LinkId.IndexOf('_');
175-
if (index > -1)
176-
{
177-
linkId = this.LinkId.Substring(index + 1);
178-
}
179-
180-
return string.Format("{0}://www.reddit.com/r/{1}/comments/{2}/_/{3}",
181-
RedditSharp.WebAgent.Protocol,
182-
this.Subreddit, this.Parent != null ? this.Parent.Id : linkId,
183-
this.Id);
184-
}
185-
}
167+
/// <inheritdoc/>
168+
public override string Shortlink => Permalink;
186169

187170
/// <summary>
188171
/// Reply to this comment.

RedditSharp/Things/Post.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,6 @@ public Post(IWebAgent agent, JToken json) : base(agent, json)
7070
[JsonProperty("over_18")]
7171
public bool NSFW { get; private set; }
7272

73-
/// <summary>
74-
/// Post permalink.
75-
/// </summary>
76-
[JsonProperty("permalink")]
77-
[JsonConverter(typeof(UrlParser))]
78-
public Uri Permalink { get; private set; }
79-
8073
/// <summary>
8174
/// Post self text markdown.
8275
/// </summary>

RedditSharp/Things/VotableThing.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ public enum VoteType
7979
/// </summary>
8080
public virtual string Shortlink => "http://redd.it/" + Id;
8181

82+
/// <summary>
83+
/// The permalink for an item
84+
/// </summary>
85+
[JsonProperty("permalink")]
86+
[JsonConverter(typeof(UrlParser))]
87+
public Uri Permalink { get; private set; }
88+
8289
/// <summary>
8390
/// Returns true if the item is sticked.
8491
/// </summary>

0 commit comments

Comments
 (0)