From dc5dd69f2e365a3addada658fe8fc69f180f6329 Mon Sep 17 00:00:00 2001 From: Chimo Date: Sat, 5 Sep 2015 17:02:17 -0400 Subject: [PATCH] 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] https://git.gnu.io/gnu/gnu-social/blob/7f30e614027fa27e83ecc32eb5443ee82d03f0f7/actions/newapplication.php#L176 [2] https://git.gnu.io/gnu/gnu-social/blob/7f30e614027fa27e83ecc32eb5443ee82d03f0f7/actions/newapplication.php#L186 --- classes/Oauth_application.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Oauth_application.php b/classes/Oauth_application.php index d5d38d0d66..5d12484cf5 100644 --- a/classes/Oauth_application.php +++ b/classes/Oauth_application.php @@ -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'),