]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/Poll/classes/Poll_response.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / plugins / Poll / classes / Poll_response.php
index 20b7700147bc1006c2a89200b0c2488ed71f5e40..0a828bf46908d29f570b6f21da9b2abe91f1e8cc 100644 (file)
@@ -46,7 +46,7 @@ class Poll_response extends Managed_DataObject
 {
     public $__table = 'poll_response'; // table name
     public $id;          // char(36) primary key not null -> UUID
-    public $uri;          // varchar(255)
+    public $uri;         // varchar(191)   not 255 because utf8mb4 takes more space
     public $poll_id;     // char(36) -> poll.id UUID
     public $profile_id;  // int -> profile.id
     public $selection;   // int -> choice #
@@ -61,7 +61,7 @@ class Poll_response extends Managed_DataObject
             'description' => 'Record of responses to polls',
             'fields' => array(
                 'id' => array('type' => 'char', 'length' => 36, 'not null' => true, 'description' => 'UUID of the response'),
-                'uri' => array('type' => 'varchar', 'length' => 255, 'not null' => true, 'description' => 'UUID to the response notice'),
+                'uri' => array('type' => 'varchar', 'length' => 191, 'not null' => true, 'description' => 'UUID to the response notice'),
                 'poll_id' => array('type' => 'char', 'length' => 36, 'not null' => true, 'description' => 'UUID of poll being responded to'),
                 'profile_id' => array('type' => 'int'),
                 'selection' => array('type' => 'int'),
@@ -85,7 +85,7 @@ class Poll_response extends Managed_DataObject
      *
      * @return Poll_response found response or null
      */
-    static function getByNotice($notice)
+    static function getByNotice(Notice $notice)
     {
         return self::getKV('uri', $notice->uri);
     }
@@ -123,12 +123,8 @@ class Poll_response extends Managed_DataObject
      *
      * @return Notice saved notice
      */
-    static function saveNew($profile, $poll, $selection, $options=null)
+    static function saveNew(Profile $profile, $poll, $selection, array $options=array())
     {
-        if (empty($options)) {
-            $options = array();
-        }
-
         if (!$poll->isValidSelection($selection)) {
             // TRANS: Client exception thrown when responding to a poll with an invalid option.
             throw new ClientException(_m('Invalid poll selection.'));
@@ -155,7 +151,7 @@ class Poll_response extends Managed_DataObject
                                         array('id' => $pr->id));
         }
 
-        common_log(LOG_DEBUG, "Saving poll response: $pr->id $pr->uri");
+        common_debug("Saving poll response: $pr->id $pr->uri");
         $pr->insert();
 
         // TRANS: Notice content voting for a poll.