Add default icon to OAuth apps

When MySQL runs in strict mode, it doesn't seem possible to add a new OAuth app.

This is because:
 * The 'icon' field has no defaults and also has NOT NULL constraint.
 * GS uploads/sets the icon[1] (if provided) after the SQL insert[2]

The easiest fix seemed to be to provide a default icon value.
This change sets the default to the  "blue peg" default avatar from the base theme.

[1]
7f30e61402/actions/newapplication.php (L176)

[2]
7f30e61402/actions/newapplication.php (L186)
This commit is contained in:
Chimo 2015-09-05 17:02:17 -04:00
parent 7f30e61402
commit dc5dd69f2e

View File

@ -166,7 +166,7 @@ class Oauth_application extends Managed_DataObject
'consumer_key' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'application consumer key'),
'name' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'name of the application'),
'description' => array('type' => 'varchar', 'length' => 191, 'description' => 'description of the application'),
'icon' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'application icon'),
'icon' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'default' => '/theme/base/default-avatar-stream.png', 'description' => 'application icon'),
'source_url' => array('type' => 'varchar', 'length' => 191, 'description' => 'application homepage - used for source link'),
'organization' => array('type' => 'varchar', 'length' => 191, 'description' => 'name of the organization running the application'),
'homepage' => array('type' => 'varchar', 'length' => 191, 'description' => 'homepage for the organization'),