mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
truncate gist titles at 120
This commit is contained in:
parent
134af233ad
commit
7abdd61354
1 changed files with 6 additions and 1 deletions
|
@ -13,7 +13,12 @@ module Oneboxer
|
||||||
|
|
||||||
def parse(data)
|
def parse(data)
|
||||||
parsed = JSON.parse(data)
|
parsed = JSON.parse(data)
|
||||||
result = {files: [], title: parsed['description']}
|
desc = parsed['description']
|
||||||
|
if desc.length > 120
|
||||||
|
desc = desc[0..120]
|
||||||
|
desc << "..."
|
||||||
|
end
|
||||||
|
result = {files: [], title: desc}
|
||||||
parsed['files'].each do |filename, attrs|
|
parsed['files'].each do |filename, attrs|
|
||||||
result[:files] << {filename: filename}.merge!(attrs)
|
result[:files] << {filename: filename}.merge!(attrs)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue