Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F17868495
D18135.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D18135.diff
View Options
diff --git a/src/applications/maniphest/xaction/ManiphestTaskPriorityTransaction.php b/src/applications/maniphest/xaction/ManiphestTaskPriorityTransaction.php
--- a/src/applications/maniphest/xaction/ManiphestTaskPriorityTransaction.php
+++ b/src/applications/maniphest/xaction/ManiphestTaskPriorityTransaction.php
@@ -129,4 +129,50 @@
}
}
+ public function validateTransactions($object, array $xactions) {
+ $errors = array();
+
+ $content_source = $this->getEditor()->getContentSource();
+ $is_web = ($content_source instanceof PhabricatorWebContentSource);
+
+ foreach ($xactions as $xaction) {
+ $value = $xaction->getNewValue();
+
+ // If this is a legitimate keyword like "low" or "high", this transaction
+ // is fine and apply normally.
+ $keyword = ManiphestTaskPriority::getTaskPriorityFromKeyword($value);
+ if ($keyword !== null) {
+ continue;
+ }
+
+ // If this is the magic "don't change things" value for editing tasks
+ // with an obsolete priority constant in the database, let it through if
+ // this is a web edit.
+ if ($value === ManiphestTaskPriority::UNKNOWN_PRIORITY_KEYWORD) {
+ if ($is_web) {
+ continue;
+ }
+ }
+
+ $keyword_list = array();
+ foreach (ManiphestTaskPriority::getTaskPriorityMap() as $pri => $name) {
+ $keyword = ManiphestTaskPriority::getKeywordForTaskPriority($pri);
+ if ($keyword === null) {
+ continue;
+ }
+ $keyword_list[] = $keyword;
+ }
+
+ $errors[] = $this->newInvalidError(
+ pht(
+ 'Task priority "%s" is not a valid task priority. Use a priority '.
+ 'keyword to choose a task priority: %s.',
+ $value,
+ implode(', ', $keyword_list)),
+ $xaction);
+ }
+
+ return $errors;
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jul 29, 7:51 AM (14 h, 45 m ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
8681767
Default Alt Text
D18135.diff (1 KB)
Attached To
Mode
D18135: Improve validation errors for changing task priorities
Attached
Detach File
Event Timeline
Log In to Comment