Merge branch 'pre_trustie_server' into trustie_server
This commit is contained in:
commit
0df402f86a
|
@ -121,7 +121,7 @@ module RepositoriesHelper
|
||||||
next if s_content.starts_with?('http://') || s_content.starts_with?('https://') || s_content.starts_with?('mailto:') || s_content.blank?
|
next if s_content.starts_with?('http://') || s_content.starts_with?('https://') || s_content.starts_with?('mailto:') || s_content.blank?
|
||||||
ext = File.extname(s_content)[1..-1]
|
ext = File.extname(s_content)[1..-1]
|
||||||
|
|
||||||
if image_type?(ext) || download_type(ext)
|
if (image_type?(ext) || download_type(ext)) && !s_content.to_s.end_with?('/')
|
||||||
s_content = File.expand_path(s_content, file_path)
|
s_content = File.expand_path(s_content, file_path)
|
||||||
s_content = s_content.split("#{Rails.root}/")[1]
|
s_content = s_content.split("#{Rails.root}/")[1]
|
||||||
# content = content.gsub(s[0], "/#{s_content}")
|
# content = content.gsub(s[0], "/#{s_content}")
|
||||||
|
@ -156,7 +156,7 @@ module RepositoriesHelper
|
||||||
def readme_decode64_content(entry, owner, repo, ref, path=nil)
|
def readme_decode64_content(entry, owner, repo, ref, path=nil)
|
||||||
Rails.logger.info("entry===#{entry["type"]} #{entry["name"]}")
|
Rails.logger.info("entry===#{entry["type"]} #{entry["name"]}")
|
||||||
content = Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
|
content = Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
|
||||||
Rails.logger.info("content===#{content}")
|
# Rails.logger.info("content===#{content}")
|
||||||
# readme_render_decode64_content(content, owner, repo, ref)
|
# readme_render_decode64_content(content, owner, repo, ref)
|
||||||
new_readme_render_decode64_content(content, owner, repo, ref, entry['path'], entry['name'])
|
new_readme_render_decode64_content(content, owner, repo, ref, entry['path'], entry['name'])
|
||||||
end
|
end
|
||||||
|
@ -165,7 +165,7 @@ module RepositoriesHelper
|
||||||
if is_readme?(entry['type'], entry['name'])
|
if is_readme?(entry['type'], entry['name'])
|
||||||
Rails.logger.info("entry===#{entry["type"]} #{entry["name"]}")
|
Rails.logger.info("entry===#{entry["type"]} #{entry["name"]}")
|
||||||
content = Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
|
content = Gitea::Repository::Entries::GetService.call(owner, repo.identifier, URI.escape(entry['path']), ref: ref)['content']
|
||||||
Rails.logger.info("content===#{content}")
|
# Rails.logger.info("content===#{content}")
|
||||||
# readme_render_decode64_content(content, owner, repo, ref)
|
# readme_render_decode64_content(content, owner, repo, ref)
|
||||||
return Base64.decode64(content).force_encoding('UTF-8')
|
return Base64.decode64(content).force_encoding('UTF-8')
|
||||||
else
|
else
|
||||||
|
|
|
@ -181,7 +181,7 @@ class User < Owner
|
||||||
scope :active, lambda { where(status: [STATUS_ACTIVE, STATUS_EDIT_INFO]) }
|
scope :active, lambda { where(status: [STATUS_ACTIVE, STATUS_EDIT_INFO]) }
|
||||||
scope :like, lambda { |keywords|
|
scope :like, lambda { |keywords|
|
||||||
sql = "CONCAT(lastname, firstname) LIKE :search OR nickname LIKE :search OR login LIKE :search OR mail LIKE :search OR nickname LIKE :search"
|
sql = "CONCAT(lastname, firstname) LIKE :search OR nickname LIKE :search OR login LIKE :search OR mail LIKE :search OR nickname LIKE :search"
|
||||||
where(sql, :search => "%#{keywords.split(" ").join('|')}%") unless keywords.blank?
|
where(sql, :search => "%#{keywords.strip}%") unless keywords.blank?
|
||||||
}
|
}
|
||||||
|
|
||||||
scope :simple_select, -> {select(:id, :login, :lastname,:firstname, :nickname, :gitea_uid, :type)}
|
scope :simple_select, -> {select(:id, :login, :lastname,:firstname, :nickname, :gitea_uid, :type)}
|
||||||
|
@ -567,7 +567,8 @@ class User < Owner
|
||||||
return '游客' unless logged?
|
return '游客' unless logged?
|
||||||
name = lastname + firstname
|
name = lastname + firstname
|
||||||
name = name.blank? ? (nickname.blank? ? login : nickname) : name
|
name = name.blank? ? (nickname.blank? ? login : nickname) : name
|
||||||
name.gsub(/\s+/, '').strip #6.11 -hs
|
# name.gsub(/\s+/, '').strip #6.11 -hs
|
||||||
|
name.strip
|
||||||
end
|
end
|
||||||
|
|
||||||
def only_real_name
|
def only_real_name
|
||||||
|
|
Loading…
Reference in New Issue