Skip to content

Commit d68c444

Browse files
author
Chad Little
committed
Convert Conpherence to use normal picture setting flows
Summary: This moves room pictures out of the dialog and into it's own PictureController. Also adds a standard image (and removes the "last person to chat" picture (though we could add that back. My plan is though that direct messages use auto use the other person's photo, after we have editengine and room pictures will have a plain, replaceable image. Test Plan: Set a new room picture, remove a picture. Run migration, see old images properly set with new image. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin Maniphest Tasks: T11730 Differential Revision: https://secure.phabricator.com/D16669
1 parent 524906a commit d68c444

20 files changed

+371
-257
lines changed

resources/builtin/conpherence.png

2.13 KB
Loading

resources/celerity/map.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
return array(
99
'names' => array(
10-
'conpherence.pkg.css' => '3c08b01f',
10+
'conpherence.pkg.css' => '4601645d',
1111
'conpherence.pkg.js' => '11f3e07e',
1212
'core.pkg.css' => '3fa66cb3',
1313
'core.pkg.js' => '30185d95',
@@ -47,7 +47,7 @@
4747
'rsrc/css/application/config/setup-issue.css' => 'f794cfc3',
4848
'rsrc/css/application/config/unhandled-exception.css' => '4c96257a',
4949
'rsrc/css/application/conpherence/durable-column.css' => '44bcaa19',
50-
'rsrc/css/application/conpherence/header-pane.css' => '6a032d4c',
50+
'rsrc/css/application/conpherence/header-pane.css' => '20a7028c',
5151
'rsrc/css/application/conpherence/menu.css' => '4f51db5a',
5252
'rsrc/css/application/conpherence/message-pane.css' => '0d7dff02',
5353
'rsrc/css/application/conpherence/notification.css' => '965db05b',
@@ -618,7 +618,7 @@
618618
'config-options-css' => '0ede4c9b',
619619
'config-page-css' => '8798e14f',
620620
'conpherence-durable-column-view' => '44bcaa19',
621-
'conpherence-header-pane-css' => '6a032d4c',
621+
'conpherence-header-pane-css' => '20a7028c',
622622
'conpherence-menu-css' => '4f51db5a',
623623
'conpherence-message-pane-css' => '0d7dff02',
624624
'conpherence-notification-css' => '965db05b',
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE {$NAMESPACE}_conpherence.conpherence_thread
2+
ADD profileImagePHID VARBINARY(64);
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
// Rebuild all Conpherence Room images to profile standards
4+
//
5+
$table = new ConpherenceThread();
6+
$conn = $table->establishConnection('w');
7+
$table_name = 'conpherence_thread';
8+
9+
foreach (new LiskRawMigrationIterator($conn, $table_name) as $row) {
10+
11+
$images = phutil_json_decode($row['imagePHIDs']);
12+
if (!$images) {
13+
return;
14+
}
15+
16+
$file_phid = idx($images, 'original');
17+
18+
$file = id(new PhabricatorFileQuery())
19+
->setViewer(PhabricatorUser::getOmnipotentUser())
20+
->withPHIDs(array($file_phid))
21+
->executeOne();
22+
23+
$xform = PhabricatorFileTransform::getTransformByKey(
24+
PhabricatorFileThumbnailTransform::TRANSFORM_PROFILE);
25+
$xformed = $xform->executeTransform($file);
26+
$new_phid = $xformed->getPHID();
27+
28+
queryfx(
29+
$conn,
30+
'UPDATE %T SET profileImagePHID = %s WHERE id = %d',
31+
$table->getTableName(),
32+
$new_phid,
33+
$row['id']);
34+
}

src/__phutil_library_map__.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@
292292
'ConpherenceEditor' => 'applications/conpherence/editor/ConpherenceEditor.php',
293293
'ConpherenceFormDragAndDropUploadControl' => 'applications/conpherence/view/ConpherenceFormDragAndDropUploadControl.php',
294294
'ConpherenceFulltextQuery' => 'applications/conpherence/query/ConpherenceFulltextQuery.php',
295-
'ConpherenceImageData' => 'applications/conpherence/constants/ConpherenceImageData.php',
296295
'ConpherenceIndex' => 'applications/conpherence/storage/ConpherenceIndex.php',
297296
'ConpherenceLayoutView' => 'applications/conpherence/view/ConpherenceLayoutView.php',
298297
'ConpherenceListController' => 'applications/conpherence/controller/ConpherenceListController.php',
@@ -309,6 +308,7 @@
309308
'ConpherenceQueryTransactionConduitAPIMethod' => 'applications/conpherence/conduit/ConpherenceQueryTransactionConduitAPIMethod.php',
310309
'ConpherenceReplyHandler' => 'applications/conpherence/mail/ConpherenceReplyHandler.php',
311310
'ConpherenceRoomListController' => 'applications/conpherence/controller/ConpherenceRoomListController.php',
311+
'ConpherenceRoomPictureController' => 'applications/conpherence/controller/ConpherenceRoomPictureController.php',
312312
'ConpherenceRoomTestCase' => 'applications/conpherence/__tests__/ConpherenceRoomTestCase.php',
313313
'ConpherenceSchemaSpec' => 'applications/conpherence/storage/ConpherenceSchemaSpec.php',
314314
'ConpherenceTestCase' => 'applications/conpherence/__tests__/ConpherenceTestCase.php',
@@ -4768,7 +4768,6 @@
47684768
'ConpherenceEditor' => 'PhabricatorApplicationTransactionEditor',
47694769
'ConpherenceFormDragAndDropUploadControl' => 'AphrontFormControl',
47704770
'ConpherenceFulltextQuery' => 'PhabricatorOffsetPagedQuery',
4771-
'ConpherenceImageData' => 'ConpherenceConstants',
47724771
'ConpherenceIndex' => 'ConpherenceDAO',
47734772
'ConpherenceLayoutView' => 'AphrontTagView',
47744773
'ConpherenceListController' => 'ConpherenceController',
@@ -4785,6 +4784,7 @@
47854784
'ConpherenceQueryTransactionConduitAPIMethod' => 'ConpherenceConduitAPIMethod',
47864785
'ConpherenceReplyHandler' => 'PhabricatorMailReplyHandler',
47874786
'ConpherenceRoomListController' => 'ConpherenceController',
4787+
'ConpherenceRoomPictureController' => 'ConpherenceController',
47884788
'ConpherenceRoomTestCase' => 'ConpherenceTestCase',
47894789
'ConpherenceSchemaSpec' => 'PhabricatorConfigSchemaSpec',
47904790
'ConpherenceTestCase' => 'PhabricatorTestCase',

src/applications/conpherence/application/PhabricatorConpherenceApplication.php

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,31 @@ public function getRemarkupRules() {
3030

3131
public function getRoutes() {
3232
return array(
33-
'/Z(?P<id>[1-9]\d*)' => 'ConpherenceViewController',
33+
'/Z(?P<id>[1-9]\d*)'
34+
=> 'ConpherenceViewController',
3435
'/conpherence/' => array(
35-
'' => 'ConpherenceListController',
36-
'thread/(?P<id>[1-9]\d*)/' => 'ConpherenceListController',
37-
'(?P<id>[1-9]\d*)/' => 'ConpherenceViewController',
36+
''
37+
=> 'ConpherenceListController',
38+
'thread/(?P<id>[1-9]\d*)/'
39+
=> 'ConpherenceListController',
40+
'(?P<id>[1-9]\d*)/'
41+
=> 'ConpherenceViewController',
3842
'(?P<id>[1-9]\d*)/(?P<messageID>[1-9]\d*)/'
39-
=> 'ConpherenceViewController',
40-
'columnview/' => 'ConpherenceColumnViewController',
41-
'new/' => 'ConpherenceNewRoomController',
43+
=> 'ConpherenceViewController',
44+
'columnview/'
45+
=> 'ConpherenceColumnViewController',
46+
'new/'
47+
=> 'ConpherenceNewRoomController',
48+
'picture/(?P<id>[1-9]\d*)/'
49+
=> 'ConpherenceRoomPictureController',
4250
'search/(?:query/(?P<queryKey>[^/]+)/)?'
43-
=> 'ConpherenceRoomListController',
44-
'panel/' => 'ConpherenceNotificationPanelController',
45-
'participant/(?P<id>[1-9]\d*)/' => 'ConpherenceParticipantController',
46-
'update/(?P<id>[1-9]\d*)/' => 'ConpherenceUpdateController',
51+
=> 'ConpherenceRoomListController',
52+
'panel/'
53+
=> 'ConpherenceNotificationPanelController',
54+
'participant/(?P<id>[1-9]\d*)/'
55+
=> 'ConpherenceParticipantController',
56+
'update/(?P<id>[1-9]\d*)/'
57+
=> 'ConpherenceUpdateController',
4758
),
4859
);
4960
}

src/applications/conpherence/constants/ConpherenceImageData.php

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/applications/conpherence/controller/ConpherenceColumnViewController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function handleRequest(AphrontRequest $request) {
1616
$latest_conpherences = id(new ConpherenceThreadQuery())
1717
->setViewer($user)
1818
->withPHIDs($conpherence_phids)
19-
->needCropPics(true)
19+
->needProfileImage(true)
2020
->needParticipantCache(true)
2121
->execute();
2222
$latest_conpherences = mpull($latest_conpherences, null, 'getPHID');
@@ -31,7 +31,7 @@ public function handleRequest(AphrontRequest $request) {
3131
$conpherence = id(new ConpherenceThreadQuery())
3232
->setViewer($user)
3333
->withIDs(array($request->getInt('id')))
34-
->needCropPics(true)
34+
->needProfileImage(true)
3535
->needTransactions(true)
3636
->setTransactionLimit(ConpherenceThreadQuery::TRANSACTION_LIMIT)
3737
->executeOne();
@@ -41,7 +41,7 @@ public function handleRequest(AphrontRequest $request) {
4141
$conpherence = id(new ConpherenceThreadQuery())
4242
->setViewer($user)
4343
->withPHIDs(array($participant->getConpherencePHID()))
44-
->needCropPics(true)
44+
->needProfileImage(true)
4545
->needTransactions(true)
4646
->setTransactionLimit(ConpherenceThreadQuery::TRANSACTION_LIMIT)
4747
->executeOne();

src/applications/conpherence/controller/ConpherenceController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ protected function buildHeaderPaneContent(
6666
$conpherence,
6767
PhabricatorPolicyCapability::CAN_EDIT);
6868

69+
if ($can_edit) {
70+
$header->setImageURL(
71+
$this->getApplicationURI('picture/'.$conpherence->getID().'/'));
72+
}
73+
6974
$participating = $conpherence->getParticipantIfExists($viewer->getPHID());
7075
$can_join = PhabricatorPolicyFilter::hasCapability(
7176
$viewer,

src/applications/conpherence/controller/ConpherenceListController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ private function loadConpherenceThreadData($participation) {
158158
$conpherences = id(new ConpherenceThreadQuery())
159159
->setViewer($user)
160160
->withPHIDs($conpherence_phids)
161-
->needCropPics(true)
161+
->needProfileImage(true)
162162
->needParticipantCache(true)
163163
->execute();
164164

src/applications/conpherence/controller/ConpherenceNotificationPanelController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public function handleRequest(AphrontRequest $request) {
1818
$conpherences = id(new ConpherenceThreadQuery())
1919
->setViewer($user)
2020
->withPHIDs(array_keys($participant_data))
21-
->needCropPics(true)
21+
->needProfileImage(true)
2222
->needTransactions(true)
2323
->setTransactionLimit(3 * 5)
2424
->needParticipantCache(true)

0 commit comments

Comments
 (0)