Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1025951
D49.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jun 13, 5:24 PM
Size
1 KB
Mime Type
text/x-diff
Expires
Sat, Jun 14, 5:24 PM (3 h, 44 m)
Engine
blob
Format
Raw Data
Handle
661405
Attached To
D49: INP-1412 - Always create extra priority for temp-only DB records
D49.id.diff
View Options
Index: branches/5.2.x/core/units/helpers/priority_helper.php
===================================================================
--- branches/5.2.x/core/units/helpers/priority_helper.php
+++ branches/5.2.x/core/units/helpers/priority_helper.php
@@ -51,7 +51,7 @@
$items_count = $this->Conn->GetOne($sql);
$current_priority = $object instanceof kDBList ? 0 : $object->GetDBField('Priority');
- if ( $is_new || $current_priority == -($items_count + 1) ) {
+ if ( $is_new || $current_priority == -($items_count + 1) || $this->isTempTableOnly($object) ) {
$items_count++;
}
@@ -73,6 +73,22 @@
}
/**
+ * Determines if an item only exists in temp table.
+ *
+ * @param kDBBase $object Object.
+ *
+ * @return boolean
+ */
+ protected function isTempTableOnly(kDBBase $object)
+ {
+ if ( !$object->IsTempTable() || ($object instanceof kDBList) ) {
+ return false;
+ }
+
+ return $object->GetID() <= 0;
+ }
+
+ /**
* Updates priorities for changed items
*
* @param kEvent $event
Event Timeline
Log In to Comment