Set title in any clones already created

This fixes a bug where titles would sometimes not show up in posts
retrieved from another thread or the archive.
This commit is contained in:
ccd0 2014-05-10 00:34:18 -07:00
parent 989ed8e787
commit a7f20420fe

View File

@ -63,11 +63,12 @@ Linkify =
i = links.length i = links.length
while i-- while i--
link = links[i] link = links[i]
Linkify.embedProcess Linkify.makeLink link, @ Linkify.embedProcess (Linkify.makeLink link, @), @
return return
embedProcess: (link) -> embedProcess: (link, post) ->
if data = Linkify.services link if data = Linkify.services link
data.push post
Linkify.embed data if Conf['Embedding'] Linkify.embed data if Conf['Embedding']
Linkify.title data if Conf['Link Title'] Linkify.title data if Conf['Link Title']
@ -148,7 +149,7 @@ Linkify =
return return
embed: (data) -> embed: (data) ->
[key, uid, options, link] = data [key, uid, options, link, post] = data
href = link.href href = link.href
embed = $.el 'a', embed = $.el 'a',
className: 'embedder' className: 'embedder'
@ -164,10 +165,8 @@ Linkify =
Linkify.cb.toggle.call embed if Conf['Auto-embed'] Linkify.cb.toggle.call embed if Conf['Auto-embed']
data.push embed
title: (data) -> title: (data) ->
[key, uid, options, link, embed] = data [key, uid, options, link, post] = data
return unless service = Linkify.types[key].title return unless service = Linkify.types[key].title
titles = Conf['CachedTitles'] titles = Conf['CachedTitles']
if title = titles[uid] if title = titles[uid]
@ -205,11 +204,11 @@ Linkify =
return el return el
title: (req, data) -> title: (req, data) ->
[key, uid, options, link, embed] = data [key, uid, options, link, post] = data
{status} = req {status} = req
service = Linkify.types[key].title service = Linkify.types[key].title
link.textContent = "[#{key}] #{switch status text = "[#{key}] #{switch status
when 200, 304 when 200, 304
service.text req.response service.text req.response
when 404 when 404
@ -220,6 +219,12 @@ Linkify =
"#{status}'d" "#{status}'d"
}" }"
link.textContent = text
for post2 in post.clones
for link2 in $$ 'a', post2.nodes.comment when link2.href is link.href
link2.textContent = text
return
ordered_types: [ ordered_types: [
key: 'audio' key: 'audio'
regExp: /(.*\.(mp3|ogg|wav))$/ regExp: /(.*\.(mp3|ogg|wav))$/