mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 10:55:54 +08:00
truncate gist titles at 120
This commit is contained in:
parent
134af233ad
commit
7abdd61354
|
@ -13,7 +13,12 @@ module Oneboxer
|
|||
|
||||
def 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|
|
||||
result[:files] << {filename: filename}.merge!(attrs)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user