Skip to content

Commit

Permalink
Merge pull request #1094 from CakeDC/bug/1084-long-avatar-images-url
Browse files Browse the repository at this point in the history
Bug #1084 Fix issue with avatar images long URL
  • Loading branch information
steinkel authored Aug 2, 2024
2 parents a7370ef + 8bf6adb commit f538426
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
declare(strict_types=1);

use Migrations\AbstractMigration;

class ChangeAvatarColumnTypeInSocialAccounts extends AbstractMigration
{
/**
* Change Method.
*
* More information on this method is available here:
* https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
* @return void
*/
public function change(): void
{
$table = $this->table('social_accounts');
$table->changeColumn('avatar', 'text', [
'default' => null,
'null' => true,
]);
$table->update();
}
}
7 changes: 6 additions & 1 deletion src/Model/Behavior/SocialBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,13 @@ public function generateUniqueUsername($username)
*/
public function findExistingForSocialLogin(\Cake\ORM\Query\SelectQuery $query, array $options)
{
$email = $options['email'] ?? null;
if (!$email) {
return $query->where('1 != 1');
}

return $query->where([
$this->_table->aliasField('email') => $options['email'],
$this->_table->aliasField('email') => $email,
]);
}

Expand Down

0 comments on commit f538426

Please sign in to comment.