user member.getId as author_username, so membrane users and plone users have portraits and author urls
This commit is contained in:
parent
a8dc5dd3f0
commit
8ccd648928
@ -4,6 +4,10 @@ Changelog
|
||||
2.3.0 (unreleased)
|
||||
------------------
|
||||
|
||||
- user member.id as author_username, so membrane users having different id
|
||||
then username still have there picture shown and author path is correct.
|
||||
[maartenkling]
|
||||
|
||||
- Corrections and additions to the Danish translation
|
||||
[aputtu]
|
||||
|
||||
|
@ -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