Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1098689
D49.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
Thu, Aug 14, 4:37 AM
Size
1 KB
Mime Type
text/x-diff
Expires
Fri, Aug 15, 4:37 AM (1 h, 21 m)
Engine
blob
Format
Raw Data
Handle
711409
Attached To
D49: INP-1412 - Always create extra priority for temp-only DB records
D49.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