Merge pull request #3507 from techAPJ/patch-1

FIX: attachment links in topic map were giving 404
This commit is contained in:
Régis Hanol 2015-05-28 12:35:57 +02:00
commit 6e8be12816
2 changed files with 6 additions and 1 deletions

View File

@ -72,7 +72,7 @@
<span class='badge badge-notification clicks' title='{{i18n 'topic_map.clicks' count=clicks}}'>{{link.clicks}}</span>
</td>
<td>
<a href="{{unbound link.url}}" target="_blank" class='topic-link track-link' data-user-id="{{unbound link.user_id}}" data-ignore-post-id="true" title="{{unbound link.url}}">
<a href="{{unbound link.url}}" target="_blank" class='topic-link track-link {{if link.attachment "attachment"}}' data-user-id="{{unbound link.user_id}}" data-ignore-post-id="true" title="{{unbound link.url}}">
{{#if link.title}}{{link.title}}{{else}}{{shorten-url link.url}}{{/if}}
</a>
{{link-domain link}}

View File

@ -4,6 +4,7 @@ class TopicLinkSerializer < ApplicationSerializer
:title,
:fancy_title,
:internal,
:attachment,
:reflection,
:clicks,
:user_id,
@ -25,6 +26,10 @@ class TopicLinkSerializer < ApplicationSerializer
object['internal'] == 't'
end
def attachment
Discourse.store.has_been_uploaded?(object['url'])
end
def reflection
object['reflection'] == 't'
end