Skip to content

Commit

Permalink
tidy
Browse files Browse the repository at this point in the history
Signed-off-by: dartcafe <github@dartcafe.de>
  • Loading branch information
dartcafe committed Dec 4, 2023
1 parent 8de7c93 commit f5bd185
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 31 deletions.
4 changes: 0 additions & 4 deletions lib/Db/EntityWithUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ public function getDisplayName(): ?string {
return $this->displayName;
}

// if (!$this->getUserId()) {
// return 'No UserId';
// }

return Container::queryClass(IUserManager::class)->get($this->getUserId())?->getDisplayName() ?? 'Deleted User';
}

Expand Down
6 changes: 0 additions & 6 deletions lib/Db/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ public function getIsLocked(): bool {
*/
public function getIsLockedByOptionLimit(): bool {
return $this->getOptionLimit() && $this->getVotesYes() >= $this->getOptionLimit() && $this->getUserVoteAnswer() !== Vote::VOTE_YES;
// return $this->getOptionLimit() && !$this->getUserVote() === Vote::VOTE_YES && $this->getVotesYes() >= $this->getOptionLimit() ;
}

public function getIsLockedByVotesLimit(): bool {
Expand All @@ -172,7 +171,6 @@ public function getIsLockedByVotesLimit(): bool {
// AND the count of yes votes of the current user is EQUAL OR GREATER THAN the vote limit
// return true (locked option)
return $this->getVoteLimit() && $this->getUserCountYesVotes() >= $this->getVoteLimit();
// return $this->getVoteLimit() && !$this->getUserVote() === Vote::VOTE_YES && $this->getUserCountYesVotes() >= $this->getVoteLimit();
}

public function getOrder(): int {
Expand Down Expand Up @@ -225,10 +223,6 @@ public function getDateStringLocalized(DateTimeZone $timeZone, IL10N $l10n): str
return (string) $dateTimeFrom . ' - ' . (string) $dateTimeTo;
}

// private function getOwnerIsNoUser(): bool {
// return !$this->userManager->get($this->getOwner()) instanceof IUser;
// }

/**
* Check, if the date option spans one or more whole days (from 00:00 to 24:00)
*/
Expand Down
9 changes: 0 additions & 9 deletions lib/Db/ShareMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,6 @@ public function __construct(
public function findByPoll(int $pollId): array {

$qb = $this->db->getQueryBuilder();
// Build the following select (MySQL)
//
// SELECT *, COUNT(votes.user_id) as voted
// FROM oc_polls_share shares
// LEFT JOIN oc_polls_votes votes
// ON shares.poll_id = votes.poll_id AND shares.user_id = votes.user_id
// WHERE shares.poll_id = $pollId
// GROUP BY shares.id
//

$qb->select('shares.*')
->from($this->getTableName(), 'shares')
Expand Down
2 changes: 0 additions & 2 deletions lib/Db/TableManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ public function purgeTables(): array {
$messages[] = 'Removed all migration records from ' . $this->dbPrefix . 'migrations';

// delete all app configs
// $query = $this->connection->getQueryBuilder();
$query->delete('appconfig')
->where('appid = :appid')
->setParameter('appid', AppConstants::APP_ID)
Expand Down Expand Up @@ -219,7 +218,6 @@ public function removeObsoleteTables(): array {
$messages = [];

foreach (TableSchema::GONE_TABLES as $tableName) {
// $tableName = $this->dbPrefix . $tableName;
if ($this->connection->tableExists($tableName)) {
$dropped = true;
$this->connection->dropTable($tableName);
Expand Down
2 changes: 1 addition & 1 deletion lib/Db/UserMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function getCurrentUserId(): string {
*/
public function getCurrentUser(): UserBase {
if ($this->currentUser) {
// if already lodaed, return user
// if already loaded, return user
return $this->currentUser;
}

Expand Down
1 change: 0 additions & 1 deletion lib/Model/Acl.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ public function getUserId(): string {

private function getDisplayName(): string {
return $this->userMapper->getCurrentUser()->getDisplayName();
// return ($this->getIsLoggedIn() ? $this->userManager->get($this->getUserId())?->getDisplayName() : $this->share->getDisplayName()) ?? '';
}

/**
Expand Down
4 changes: 0 additions & 4 deletions lib/Model/Mail/ConfirmationMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ protected function buildBody(): void {
);
}

// $this->emailTemplate->addBodyText(
// $this->l10n->t('Used languageCode is %1$s, %2$s, %3$s', [$this->l10n->getLanguageCode(), $this->l10n->getLocaleCode(), $this->transFactory->localeExists($this->l10n->getLanguageCode())])
// );

if ($this->poll->getDescription()) {
$this->emailTemplate->addBodyText($this->getRichDescription(), $this->poll->getDescription());
}
Expand Down
2 changes: 0 additions & 2 deletions lib/Model/UserBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,11 @@ public function getIcon(): string {
}

public function getEmailAddress(): string {
// return $this->emailAddress;
return $this->emailAddress ?? '';
}

// Function for obfuscating mail adresses; Default return the email address
public function getEmailAddressMasked(): string {
// return $this->emailAddress;
return $this->emailAddress ?? '';
}

Expand Down
2 changes: 0 additions & 2 deletions lib/Service/PollService.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ public function add(string $type, string $title): Poll {
* @return Poll
*/
public function update(int $pollId, array $poll): Poll {
// $this->acl->setPollId($pollId, Acl::PERMISSION_POLL_EDIT);
// $this->poll = $this->acl->getPoll();
$this->poll = $this->pollMapper->find($pollId);

// Validate valuess
Expand Down

0 comments on commit f5bd185

Please sign in to comment.