diff --git a/autoupdate b/autoupdate index fcbcfb8d6..b778a1654 160000 --- a/autoupdate +++ b/autoupdate @@ -1 +1 @@ -Subproject commit fcbcfb8d68c083a7c9204548b0f0c1bb61ef49c0 +Subproject commit b778a165491d503aa7e286c3859a4d601c827ddc diff --git a/client/src/app/shared/models/poll/base-option.ts b/client/src/app/shared/models/poll/base-option.ts index 74d15e79c..89683cff7 100644 --- a/client/src/app/shared/models/poll/base-option.ts +++ b/client/src/app/shared/models/poll/base-option.ts @@ -6,7 +6,7 @@ export abstract class BaseOption extends BaseDecimalModel { public no: number; public abstain: number; public poll_id: number; - public voted_id: number[]; + public votes_id: number[]; protected getDecimalFields(): string[] { return ['yes', 'no', 'abstain']; diff --git a/server/openslides/poll/access_permissions.py b/server/openslides/poll/access_permissions.py index f9cd83a20..fc3d75b84 100644 --- a/server/openslides/poll/access_permissions.py +++ b/server/openslides/poll/access_permissions.py @@ -77,7 +77,7 @@ class BasePollAccessPermissions(BaseAccessPermissions): Non-published polls will be restricted: - Remove votes* values from the poll - Remove yes/no/abstain fields from options - - Remove fields given in self.assitional_fields from the poll + - Remove fields given in self.additional_fields from the poll """ # add has_voted for all users to check whether op has voted @@ -100,22 +100,23 @@ class BasePollAccessPermissions(BaseAccessPermissions): ) poll["user_has_voted_for_delegations"] = voted_for_delegations + data_copy = json.loads(json.dumps(full_data)) + for poll in data_copy: + if poll["state"] not in (BasePoll.STATE_FINISHED, BasePoll.STATE_PUBLISHED): + del poll["voted_id"] + if await async_has_perm(user_id, self.manage_permission): - data = full_data + pass elif await async_has_perm(user_id, self.base_permission): - data = [] - for poll in full_data: + for poll in data_copy: if poll["state"] != BasePoll.STATE_PUBLISHED: - poll = json.loads( - json.dumps(poll) - ) # copy, so we can remove some fields. del poll["votesvalid"] del poll["votesinvalid"] del poll["votescast"] - del poll["voted_id"] + if "voted_id" in poll: # could be removed earlier + del poll["voted_id"] for field in self.additional_fields: del poll[field] - data.append(poll) else: - data = [] - return data + data_copy = [] + return data_copy diff --git a/server/tests/integration/assignments/test_polls.py b/server/tests/integration/assignments/test_polls.py index 865831584..935f5cc9c 100644 --- a/server/tests/integration/assignments/test_polls.py +++ b/server/tests/integration/assignments/test_polls.py @@ -2733,7 +2733,6 @@ class VoteAssignmentPollNamedAutoupdates(VoteAssignmentPollAutoupdatesBaseClass) "votesvalid": "1.000000", "user_has_voted": False, "user_has_voted_for_delegations": [], - "voted_id": [self.user.id], }, "assignments/assignment-option:1": { "abstain": "1.000000", @@ -2926,7 +2925,6 @@ class VoteAssignmentPollPseudoanonymousAutoupdates( "type": AssignmentPoll.TYPE_PSEUDOANONYMOUS, "user_has_voted": False, "user_has_voted_for_delegations": [], - "voted_id": [self.user.id], "onehundred_percent_base": AssignmentPoll.PERCENT_BASE_CAST, "majority_method": AssignmentPoll.MAJORITY_TWO_THIRDS, "min_votes_amount": 1, diff --git a/server/tests/integration/motions/test_polls.py b/server/tests/integration/motions/test_polls.py index 487053d96..342f7b62b 100644 --- a/server/tests/integration/motions/test_polls.py +++ b/server/tests/integration/motions/test_polls.py @@ -165,7 +165,6 @@ class CreateMotionPoll(TestCase): "votescast": "0.000000", "options_id": [1], "id": 1, - "voted_id": [], "user_has_voted": False, "user_has_voted_for_delegations": [], }, @@ -1081,7 +1080,6 @@ class VoteMotionPollNamedAutoupdates(TestCase): "id": 1, "user_has_voted": False, "user_has_voted_for_delegations": [], - "voted_id": [self.user.id], }, "motions/motion-vote:1": { "pollstate": 2, @@ -1224,7 +1222,6 @@ class VoteMotionPollPseudoanonymousAutoupdates(TestCase): "id": 1, "user_has_voted": False, "user_has_voted_for_delegations": [], - "voted_id": [self.user.id], }, "motions/motion-vote:1": { "pollstate": 2,