[Git][noosfero/noosfero][stable-1.10] Merge branch 'no-author' into 'master'
Rodrigo Souto
gitlab at mg.gitlab.com
Fri Mar 9 14:06:29 BRT 2018
Rodrigo Souto pushed to branch stable-1.10 at Noosfero / noosfero
Commits:
59383918 by Rodrigo Souto at 2018-03-09T17:06:13Z
Merge branch 'no-author' into 'master'
article: return environment name if author_name is nil
See merge request noosfero/noosfero!1413
(cherry picked from commit acf22012d001bab3638670d36df3c464e3aaa718)
4c516c3d article: return environment name if author_name is nil
- - - - -
2 changed files:
- app/models/article.rb
- test/unit/article_test.rb
Changes:
=====================================
app/models/article.rb
=====================================
--- a/app/models/article.rb
+++ b/app/models/article.rb
@@ -771,9 +771,9 @@ class Article < ApplicationRecord
def author_name(version_number = nil)
person = author_by_version(version_number)
if version_number
- person ? person.name : _('Unknown')
+ person ? person.name : environment.name
else
- person ? person.name : (setting[:author_name] || _('Unknown'))
+ person ? person.name : (setting[:author_name] || environment.name)
end
end
=====================================
test/unit/article_test.rb
=====================================
--- a/test/unit/article_test.rb
+++ b/test/unit/article_test.rb
@@ -2347,4 +2347,10 @@ class ArticleTest < ActiveSupport::TestCase
assert article.metadata['custom_fields']['text-1'].present?
end
+ should 'return environment name as author if no author name available' do
+ article = fast_create(Article)
+ article.author = nil
+ assert_equal article.environment.name, article.author_name
+ end
+
end
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/593839188f7cd2f1659b61483833825a081d4153
---
View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/593839188f7cd2f1659b61483833825a081d4153
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20180309/c58ef404/attachment.html>
More information about the Noosfero-dev
mailing list