Skip to content

Commit 5a104ed

Browse files
author
epriestley
committed
Add icons, colors and action names to Maniphest timeline view
Summary: Ref T2217. These are mostly me making stuff up rather than some bird's-eye view of color and iconography across applications, yell if any of these seem off once this rolls out. Test Plan: - Looked at a bunch of transactions, saw reasonable looking colors and icons. - Sent email, saw appropriate subject line actions. Reviewers: btrahan, chad Reviewed By: chad CC: aran Maniphest Tasks: T2217 Differential Revision: https://secure.phabricator.com/D7075
1 parent d9aa9ee commit 5a104ed

File tree

1 file changed

+143
-0
lines changed

1 file changed

+143
-0
lines changed

src/applications/maniphest/storage/ManiphestTransactionPro.php

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,149 @@ public function getRequiredHandlePHIDs() {
7474
return $phids;
7575
}
7676

77+
78+
public function getColor() {
79+
$old = $this->getOldValue();
80+
$new = $this->getNewValue();
81+
82+
switch ($this->getTransactionType()) {
83+
case self::TYPE_STATUS:
84+
if ($new == ManiphestTaskStatus::STATUS_OPEN) {
85+
if ($old) {
86+
return 'violet';
87+
} else {
88+
return 'green';
89+
}
90+
} else {
91+
return 'black';
92+
}
93+
94+
case self::TYPE_PRIORITY:
95+
if ($old == ManiphestTaskPriority::getDefaultPriority()) {
96+
return 'green';
97+
} else if ($old > $new) {
98+
return 'grey';
99+
} else {
100+
return 'yellow';
101+
}
102+
103+
}
104+
105+
return parent::getColor();
106+
}
107+
108+
public function getActionName() {
109+
$old = $this->getOldValue();
110+
$new = $this->getNewValue();
111+
112+
switch ($this->getTransactionType()) {
113+
case self::TYPE_TITLE:
114+
return pht('Retitled');
115+
116+
case self::TYPE_STATUS:
117+
if ($new == ManiphestTaskStatus::STATUS_OPEN) {
118+
if ($old) {
119+
return pht('Reopened');
120+
} else {
121+
return pht('Created');
122+
}
123+
} else {
124+
switch ($new) {
125+
case ManiphestTaskStatus::STATUS_CLOSED_SPITE:
126+
return pht('Spited');
127+
case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE:
128+
return pht('Merged');
129+
default:
130+
return pht('Closed');
131+
}
132+
}
133+
134+
case self::TYPE_DESCRIPTION:
135+
return pht('Edited');
136+
137+
case self::TYPE_OWNER:
138+
if ($this->getAuthorPHID() == $new) {
139+
return pht('Claimed');
140+
} else if (!$new) {
141+
return pht('Up For Grabs');
142+
} else if (!$old) {
143+
return pht('Assigned');
144+
} else {
145+
return pht('Reassigned');
146+
}
147+
148+
case self::TYPE_CCS:
149+
return pht('Changed CC');
150+
151+
case self::TYPE_PROJECTS:
152+
return pht('Changed Projects');
153+
154+
case self::TYPE_PRIORITY:
155+
if ($old == ManiphestTaskPriority::getDefaultPriority()) {
156+
return pht('Triaged');
157+
} else if ($old > $new) {
158+
return pht('Lowered Priority');
159+
} else {
160+
return pht('Raised Priority');
161+
}
162+
163+
case self::TYPE_EDGE:
164+
case self::TYPE_ATTACH:
165+
return pht('Attached');
166+
}
167+
168+
return parent::getActionName();
169+
}
170+
171+
public function getIcon() {
172+
$old = $this->getOldValue();
173+
$new = $this->getNewValue();
174+
175+
switch ($this->getTransactionType()) {
176+
case self::TYPE_TITLE:
177+
return 'edit';
178+
179+
case self::TYPE_STATUS:
180+
if ($new == ManiphestTaskStatus::STATUS_OPEN) {
181+
return 'create';
182+
} else {
183+
switch ($new) {
184+
case ManiphestTaskStatus::STATUS_CLOSED_SPITE:
185+
return 'dislike';
186+
case ManiphestTaskStatus::STATUS_CLOSED_DUPLICATE:
187+
return 'delete';
188+
default:
189+
return 'check';
190+
}
191+
}
192+
193+
case self::TYPE_DESCRIPTION:
194+
return 'edit';
195+
196+
case self::TYPE_PROJECTS:
197+
return 'tag';
198+
199+
case self::TYPE_PRIORITY:
200+
if ($old == ManiphestTaskPriority::getDefaultPriority()) {
201+
return 'start-sandcastle';
202+
return pht('Triaged');
203+
} else if ($old > $new) {
204+
return 'download-alt';
205+
} else {
206+
return 'upload';
207+
}
208+
209+
case self::TYPE_EDGE:
210+
case self::TYPE_ATTACH:
211+
return 'attach';
212+
213+
}
214+
215+
return parent::getIcon();
216+
}
217+
218+
219+
77220
public function getTitle() {
78221
$author_phid = $this->getAuthorPHID();
79222

0 commit comments

Comments
 (0)