Merge pull request #41 from maartenkling/master
uses member.getId as author_username, so membrane users have portrait and author url
This commit is contained in:
commit
f65ef6cfe7
@ -1,6 +1,14 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
2.3.2 (unreleased)
|
||||
------------------
|
||||
|
||||
- use member.getId as author_username, so membrane users having different id
|
||||
then username still have there picture shown and author path is correct.
|
||||
[maartenkling]
|
||||
|
||||
|
||||
2.3.1 (2014-02-22)
|
||||
------------------
|
||||
|
||||
|
@ -195,7 +195,7 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
||||
elif not portal_membership.isAnonymousUser() and can_reply:
|
||||
# Member
|
||||
member = portal_membership.getAuthenticatedMember()
|
||||
username = member.getUserName()
|
||||
memberid = member.getId()
|
||||
user = member.getUser()
|
||||
email = member.getProperty('email')
|
||||
fullname = member.getProperty('fullname')
|
||||
@ -207,9 +207,9 @@ class CommentForm(extensible.ExtensibleForm, form.Form):
|
||||
if email and isinstance(email, str):
|
||||
email = unicode(email, 'utf-8')
|
||||
comment.changeOwnership(user, recursive=False)
|
||||
comment.manage_setLocalRoles(username, ["Owner"])
|
||||
comment.creator = username
|
||||
comment.author_username = username
|
||||
comment.manage_setLocalRoles(memberid, ["Owner"])
|
||||
comment.creator = memberid
|
||||
comment.author_username = memberid
|
||||
comment.author_name = fullname
|
||||
comment.author_email = email
|
||||
comment.creation_date = datetime.utcnow()
|
||||
|
@ -126,12 +126,12 @@ class TestCommentForm(unittest.TestCase):
|
||||
|
||||
for comment in comments:
|
||||
self.assertEqual(comment.text, u"bar")
|
||||
self.assertEqual(comment.creator, "test-user")
|
||||
self.assertEqual(comment.creator, "test_user_1_")
|
||||
self.assertEqual(comment.getOwner().getUserName(), "test-user")
|
||||
local_roles = comment.get_local_roles()
|
||||
self.assertEqual(len(local_roles), 1)
|
||||
userid, roles = local_roles[0]
|
||||
self.assertEqual(userid, 'test-user')
|
||||
self.assertEqual(userid, 'test_user_1_')
|
||||
self.assertEqual(len(roles), 1)
|
||||
self.assertEqual(roles[0], 'Owner')
|
||||
|
||||
@ -558,4 +558,3 @@ class TestCommentsViewlet(unittest.TestCase):
|
||||
localized_time = self.viewlet.format_time(python_time)
|
||||
self.assertTrue(
|
||||
localized_time in ['Feb 01, 2009 11:32 PM', '2009-02-01 23:32'])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user