Ran into a problem with setting up new moderation on a list.
https://github.com/groupserver/gs.group.member.manage/blob/master/gs/group/member/manage/utils.py
def moderate(groupInfo, userInfo):
listInfo = GSMailingListInfo(groupInfo.groupObj)
moderatedIds = [m.id for m in listInfo.moderatees]
assert userInfo.id not in moderatedIds, '%s (%s) was marked for '\
'moderation in %s (%s), but is already moderated.' % \
(userInfo.name, userInfo.id, groupInfo.name, groupInfo.id)
So, when you go to moderate someone, if they are already moderated, it
throws an error.
https://github.com/groupserver/Products.GSGroupMember/blob/master/Products/GSGroupMember/groupMembersInfo.py
def moderatees(self):
retval = []
if self.mlistInfo.is_moderated:
moderatedIds = self.mlistInfo.get_property('moderated_members')
\
or []
if moderatedIds:
for uId in moderatedIds:
if uId not in self.memberIds:
m = u'The user ID %s is listed as a moderated
member '\
u'in the group %s (%s) on the site %s (%s), but
is '\
u'not a member of the group.' %\
(uId, self.groupInfo.name, self.groupInfo.id,
self.siteInfo.name, self.siteInfo.id)
m = m.encode('ascii', 'ignore')
log.warn(m)
else:
retval.append(createObject('groupserver.UserFromId',
self.context, uId))
elif not(self.mlistInfo.is_moderate_new):
for u in self.fullMembers:
isPtnCoach = self.ptnCoach and (self.ptnCoach.id == u.id
)\
or False
isGrpAdmin = u.id in [a.id for a in self.groupAdmins]
isSiteAdmin = u.id in [a.id for a in self.siteAdmins]
isModerator = u.id in [m.id for m in self.moderators]
isBlocked = u.id in [m.id for m in self.blockedMembers]
if (not(isSiteAdmin) and not(isGrpAdmin) and
not(isPtnCoach) and not(isModerator) and
not(isBlocked)):
retval.append(u)
return retval
So, in the moderatees function, do we currently have a list of
moderatedIds? If so great.
If we do not have a current list, do we not have "moderate all new members"
set? If so, find all members that are not currently otherwise privileged or
blocked, and return them as moderated.
Which means if I:
1) Turn on moderation for my group (but not the "all new members that join
this group" option), and don't currently have anyone that's moderated.
2) Try to moderate a member
3) Groupserver looks up the list of moderated members, gets told the member
is already in the list, and errors out.
Also note that the interface does not
So the only way to begin moderating is to turn on the all new members
option, moderate a member, then flip to the regular moderation option. No
bueno.
I'm not sure what the logic change there needs to be, but, yeah. Also,
having an option for "moderate all non-privileged members" would be
awesome, but I don't think is the intent of the current moderation settings.
Thanks,
Joe Terranova
https://github.com/groupserver/gs.group.member.manage/blob/master/gs/group/member/manage/utils.py
def moderate(groupInfo, userInfo):
listInfo = GSMailingListInfo(groupInfo.groupObj)
moderatedIds = [m.id for m in listInfo.moderatees]
assert userInfo.id not in moderatedIds, '%s (%s) was marked for '\
'moderation in %s (%s), but is already moderated.' % \
(userInfo.name, userInfo.id, groupInfo.name, groupInfo.id)
So, when you go to moderate someone, if they are already moderated, it
throws an error.
https://github.com/groupserver/Products.GSGroupMember/blob/master/Products/GSGroupMember/groupMembersInfo.py
def moderatees(self):
retval = []
if self.mlistInfo.is_moderated:
moderatedIds = self.mlistInfo.get_property('moderated_members')
\
or []
if moderatedIds:
for uId in moderatedIds:
if uId not in self.memberIds:
m = u'The user ID %s is listed as a moderated
member '\
u'in the group %s (%s) on the site %s (%s), but
is '\
u'not a member of the group.' %\
(uId, self.groupInfo.name, self.groupInfo.id,
self.siteInfo.name, self.siteInfo.id)
m = m.encode('ascii', 'ignore')
log.warn(m)
else:
retval.append(createObject('groupserver.UserFromId',
self.context, uId))
elif not(self.mlistInfo.is_moderate_new):
for u in self.fullMembers:
isPtnCoach = self.ptnCoach and (self.ptnCoach.id == u.id
)\
or False
isGrpAdmin = u.id in [a.id for a in self.groupAdmins]
isSiteAdmin = u.id in [a.id for a in self.siteAdmins]
isModerator = u.id in [m.id for m in self.moderators]
isBlocked = u.id in [m.id for m in self.blockedMembers]
if (not(isSiteAdmin) and not(isGrpAdmin) and
not(isPtnCoach) and not(isModerator) and
not(isBlocked)):
retval.append(u)
return retval
So, in the moderatees function, do we currently have a list of
moderatedIds? If so great.
If we do not have a current list, do we not have "moderate all new members"
set? If so, find all members that are not currently otherwise privileged or
blocked, and return them as moderated.
Which means if I:
1) Turn on moderation for my group (but not the "all new members that join
this group" option), and don't currently have anyone that's moderated.
2) Try to moderate a member
3) Groupserver looks up the list of moderated members, gets told the member
is already in the list, and errors out.
Also note that the interface does not
So the only way to begin moderating is to turn on the all new members
option, moderate a member, then flip to the regular moderation option. No
bueno.
I'm not sure what the logic change there needs to be, but, yeah. Also,
having an option for "moderate all non-privileged members" would be
awesome, but I don't think is the intent of the current moderation settings.
Thanks,
Joe Terranova