- $cur = common_current_user();
-
- if (!empty($cur)) {
- $curProfile = $cur->getProfile();
- } else {
- $curProfile = null;
- }
-
- if (!$this->notice->inScope($curProfile)) {
- throw new ClientException(_('Not available.'), 403);
- }
-
- $this->user = User::staticGet('id', $this->poll->profile_id);
-
- if (empty($this->user)) {
- // TRANS: Client exception thrown trying to view a poll of a non-existing user.
- throw new ClientException(_m('No such user.'), 404);
- }
-
- $this->profile = $this->user->getProfile();
-
- if (empty($this->profile)) {
- // TRANS: Server exception thrown trying to view a poll for a user for which the profile could not be loaded.
- throw new ServerException(_m('User without a profile.'));
- }
-
- $this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
-
- return true;