diff --git a/app/models/approve_article.rb b/app/models/approve_article.rb index ada0df7..a2f6660 100644 --- a/app/models/approve_article.rb +++ b/app/models/approve_article.rb @@ -4,7 +4,7 @@ class ApproveArticle < Task validates_presence_of :requestor_id, :target_id def description - _('%s wants to publish %s') % [requestor.name, article.name] + _('%{author} wants to publish "%{article}" on %{community}') % { :author => requestor.name, :article => article.title, :community => target.name } end def data @@ -41,7 +41,7 @@ class ApproveArticle < Task def target_notification_message description + "\n\n" + - _('You need login to accept this.') + _('You need to login on %{system} in order to approve or reject this article. You can use the address below to do that.') % { :system => target.environment.name } end end diff --git a/app/models/person.rb b/app/models/person.rb index ae9b2be..7e8c8c3 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -141,6 +141,11 @@ class Person < Profile self.user.nil? ? nil : self.user.email end + # Returns the user e-mail. + def contact_email + email + end + def email= (email) self.user.email = email if ! self.user.nil? end diff --git a/app/models/profile.rb b/app/models/profile.rb index c296425..f886225 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -226,12 +226,11 @@ class Profile < ActiveRecord::Base xss_terminate :only => [ :name, :nickname, :address, :contact_phone ] - # returns the contact email for this profile. By default returns the the - # e-mail of the owner user. + # returns the contact email for this profile. # # Subclasses may -- and should -- override this method. def contact_email - self.user ? self.user.email : nil + raise NotImplementedError end # gets recent documents in this profile, ordered from the most recent to the diff --git a/test/unit/person_test.rb b/test/unit/person_test.rb index 4220f88..881a43c 100644 --- a/test/unit/person_test.rb +++ b/test/unit/person_test.rb @@ -112,6 +112,12 @@ class PersonTest < Test::Unit::TestCase assert_nil p.email end + should 'use email addreess as contact email' do + p = Person.new + p.stubs(:email).returns('my@email.com') + assert_equal 'my@email.com', p.contact_email + end + should 'set email through person instance' do u = create_user('testuser') p = u.person diff --git a/test/unit/profile_test.rb b/test/unit/profile_test.rb index 54a3b03..67091a4 100644 --- a/test/unit/profile_test.rb +++ b/test/unit/profile_test.rb @@ -1133,6 +1133,12 @@ class ProfileTest < Test::Unit::TestCase assert_equal [p], c.admins end + should 'not implement contact_email' do + assert_raise NotImplementedError do + Profile.new.contact_email + end + end + private def assert_invalid_identifier(id) -- libgit2 0.21.2