3
3
final class PhameBlogTransaction
4
4
extends PhabricatorApplicationTransaction {
5
5
6
- const TYPE_NAME = 'phame.blog.name ' ;
7
- const TYPE_SUBTITLE = 'phame.blog.subtitle ' ;
8
- const TYPE_DESCRIPTION = 'phame.blog.description ' ;
9
- const TYPE_FULLDOMAIN = 'phame.blog.full.domain ' ;
10
- const TYPE_STATUS = 'phame.blog.status ' ;
11
- const TYPE_PARENTSITE = 'phame.blog.parent.site ' ;
12
- const TYPE_PARENTDOMAIN = 'phame.blog.parent.domain ' ;
6
+ const TYPE_NAME = 'phame.blog.name ' ;
7
+ const TYPE_SUBTITLE = 'phame.blog.subtitle ' ;
8
+ const TYPE_DESCRIPTION = 'phame.blog.description ' ;
9
+ const TYPE_FULLDOMAIN = 'phame.blog.full.domain ' ;
10
+ const TYPE_STATUS = 'phame.blog.status ' ;
11
+ const TYPE_PARENTSITE = 'phame.blog.parent.site ' ;
12
+ const TYPE_PARENTDOMAIN = 'phame.blog.parent.domain ' ;
13
+ const TYPE_PROFILEIMAGE = 'phame.blog.header.image ' ;
14
+ const TYPE_HEADERIMAGE = 'phame.blog.profile.image ' ;
13
15
14
16
const MAILTAG_DETAILS = 'phame-blog-details ' ;
15
17
const MAILTAG_SUBSCRIBERS = 'phame-blog-subscribers ' ;
@@ -34,6 +36,22 @@ public function shouldHide() {
34
36
return parent ::shouldHide ();
35
37
}
36
38
39
+ public function getRequiredHandlePHIDs () {
40
+ $ old = $ this ->getOldValue ();
41
+ $ new = $ this ->getNewValue ();
42
+
43
+ $ req_phids = array ();
44
+ switch ($ this ->getTransactionType ()) {
45
+ case self ::TYPE_PROFILEIMAGE :
46
+ case self ::TYPE_HEADERIMAGE :
47
+ $ req_phids [] = $ old ;
48
+ $ req_phids [] = $ new ;
49
+ break ;
50
+ }
51
+
52
+ return array_merge ($ req_phids , parent ::getRequiredHandlePHIDs ());
53
+ }
54
+
37
55
public function getIcon () {
38
56
$ old = $ this ->getOldValue ();
39
57
$ new = $ this ->getNewValue ();
@@ -48,6 +66,10 @@ public function getIcon() {
48
66
case self ::TYPE_DESCRIPTION :
49
67
case self ::TYPE_FULLDOMAIN :
50
68
return 'fa-pencil ' ;
69
+ case self ::TYPE_HEADERIMAGE :
70
+ return 'fa-image ' ;
71
+ case self ::TYPE_PROFILEIMAGE :
72
+ return 'fa-star ' ;
51
73
case self ::TYPE_STATUS :
52
74
if ($ new == PhameBlog::STATUS_ARCHIVED ) {
53
75
return 'fa-ban ' ;
@@ -88,6 +110,8 @@ public function getMailTags() {
88
110
case self ::TYPE_FULLDOMAIN :
89
111
case self ::TYPE_PARENTSITE :
90
112
case self ::TYPE_PARENTDOMAIN :
113
+ case self ::TYPE_PROFILEIMAGE :
114
+ case self ::TYPE_HEADERIMAGE :
91
115
$ tags [] = self ::MAILTAG_DETAILS ;
92
116
break ;
93
117
default :
@@ -172,6 +196,42 @@ public function getTitle() {
172
196
$ new );
173
197
}
174
198
break ;
199
+ case self ::TYPE_HEADERIMAGE :
200
+ if (!$ old ) {
201
+ return pht (
202
+ "%s set this blog's header image to %s. " ,
203
+ $ this ->renderHandleLink ($ author_phid ),
204
+ $ this ->renderHandleLink ($ new ));
205
+ } else if (!$ new ) {
206
+ return pht (
207
+ "%s removed this blog's header image. " ,
208
+ $ this ->renderHandleLink ($ author_phid ));
209
+ } else {
210
+ return pht (
211
+ "%s updated this blog's header image from %s to %s. " ,
212
+ $ this ->renderHandleLink ($ author_phid ),
213
+ $ this ->renderHandleLink ($ old ),
214
+ $ this ->renderHandleLink ($ new ));
215
+ }
216
+ break ;
217
+ case self ::TYPE_PROFILEIMAGE :
218
+ if (!$ old ) {
219
+ return pht (
220
+ "%s set this blog's profile image to %s. " ,
221
+ $ this ->renderHandleLink ($ author_phid ),
222
+ $ this ->renderHandleLink ($ new ));
223
+ } else if (!$ new ) {
224
+ return pht (
225
+ "%s removed this blog's profile image. " ,
226
+ $ this ->renderHandleLink ($ author_phid ));
227
+ } else {
228
+ return pht (
229
+ "%s updated this blog's profile image from %s to %s. " ,
230
+ $ this ->renderHandleLink ($ author_phid ),
231
+ $ this ->renderHandleLink ($ old ),
232
+ $ this ->renderHandleLink ($ new ));
233
+ }
234
+ break ;
175
235
case self ::TYPE_STATUS :
176
236
switch ($ new ) {
177
237
case PhameBlog::STATUS_ACTIVE :
@@ -248,6 +308,18 @@ public function getTitleForFeed() {
248
308
$ this ->renderHandleLink ($ author_phid ),
249
309
$ this ->renderHandleLink ($ object_phid ));
250
310
break ;
311
+ case self ::TYPE_HEADERIMAGE :
312
+ return pht (
313
+ '%s updated the header image for %s. ' ,
314
+ $ this ->renderHandleLink ($ author_phid ),
315
+ $ this ->renderHandleLink ($ object_phid ));
316
+ break ;
317
+ case self ::TYPE_PROFILEIMAGE :
318
+ return pht (
319
+ '%s updated the profile image for %s. ' ,
320
+ $ this ->renderHandleLink ($ author_phid ),
321
+ $ this ->renderHandleLink ($ object_phid ));
322
+ break ;
251
323
case self ::TYPE_STATUS :
252
324
switch ($ new ) {
253
325
case PhameBlog::STATUS_ACTIVE :
0 commit comments