mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-29 08:50:58 +01:00
Conpherence - make conpherence load the bare minimum of data
Summary: also re-enables the updating of the widgets and "cleans up" the javascript a tad. Ref T2867 Test Plan: all sorts of conpherence fun like adding people to threads, adding files, pontificating, etc Reviewers: epriestley, chad Reviewed By: epriestley CC: aran, Korvin Maniphest Tasks: T2867 Differential Revision: https://secure.phabricator.com/D5595
This commit is contained in:
parent
dbcd38aa88
commit
18c76b8a46
17 changed files with 222 additions and 235 deletions
|
@ -913,7 +913,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'conpherence-menu-css' =>
|
'conpherence-menu-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/69980966/rsrc/css/application/conpherence/menu.css',
|
'uri' => '/res/7413379f/rsrc/css/application/conpherence/menu.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
@ -940,7 +940,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'conpherence-widget-pane-css' =>
|
'conpherence-widget-pane-css' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/fda7cf40/rsrc/css/application/conpherence/widget-pane.css',
|
'uri' => '/res/28fbffe3/rsrc/css/application/conpherence/widget-pane.css',
|
||||||
'type' => 'css',
|
'type' => 'css',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
@ -1289,7 +1289,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'javelin-behavior-conpherence-menu' =>
|
'javelin-behavior-conpherence-menu' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/29585411/rsrc/js/application/conpherence/behavior-menu.js',
|
'uri' => '/res/e8479b8e/rsrc/js/application/conpherence/behavior-menu.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
@ -1305,7 +1305,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'javelin-behavior-conpherence-pontificate' =>
|
'javelin-behavior-conpherence-pontificate' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/ae5f5f61/rsrc/js/application/conpherence/behavior-pontificate.js',
|
'uri' => '/res/68f1e046/rsrc/js/application/conpherence/behavior-pontificate.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
@ -1319,7 +1319,7 @@ celerity_register_resource_map(array(
|
||||||
),
|
),
|
||||||
'javelin-behavior-conpherence-widget-pane' =>
|
'javelin-behavior-conpherence-widget-pane' =>
|
||||||
array(
|
array(
|
||||||
'uri' => '/res/c0990399/rsrc/js/application/conpherence/behavior-widget-pane.js',
|
'uri' => '/res/0c0fc5ef/rsrc/js/application/conpherence/behavior-widget-pane.js',
|
||||||
'type' => 'js',
|
'type' => 'js',
|
||||||
'requires' =>
|
'requires' =>
|
||||||
array(
|
array(
|
||||||
|
|
|
@ -46,7 +46,7 @@ abstract class ConpherenceController extends PhabricatorController {
|
||||||
$all_conpherences = id(new ConpherenceThreadQuery())
|
$all_conpherences = id(new ConpherenceThreadQuery())
|
||||||
->setViewer($user)
|
->setViewer($user)
|
||||||
->withPHIDs($all_conpherence_phids)
|
->withPHIDs($all_conpherence_phids)
|
||||||
->needAllTransactions(true)
|
->needParticipantCache(true)
|
||||||
->execute();
|
->execute();
|
||||||
$unread_conpherences = array_select_keys(
|
$unread_conpherences = array_select_keys(
|
||||||
$all_conpherences,
|
$all_conpherences,
|
||||||
|
|
|
@ -31,7 +31,6 @@ final class ConpherenceListController
|
||||||
if ($conpherence_id) {
|
if ($conpherence_id) {
|
||||||
$conpherence = id(new ConpherenceThreadQuery())
|
$conpherence = id(new ConpherenceThreadQuery())
|
||||||
->setViewer($user)
|
->setViewer($user)
|
||||||
->needAllTransactions(true)
|
|
||||||
->withIDs(array($conpherence_id))
|
->withIDs(array($conpherence_id))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
if (!$conpherence) {
|
if (!$conpherence) {
|
||||||
|
|
|
@ -30,9 +30,9 @@ final class ConpherenceUpdateController
|
||||||
$conpherence = id(new ConpherenceThreadQuery())
|
$conpherence = id(new ConpherenceThreadQuery())
|
||||||
->setViewer($user)
|
->setViewer($user)
|
||||||
->withIDs(array($conpherence_id))
|
->withIDs(array($conpherence_id))
|
||||||
|
->needFilePHIDs(true)
|
||||||
->needOrigPics(true)
|
->needOrigPics(true)
|
||||||
->needHeaderPics(true)
|
->needHeaderPics(true)
|
||||||
->needAllTransactions(true)
|
|
||||||
->executeOne();
|
->executeOne();
|
||||||
$supported_formats = PhabricatorFile::getTransformableImageFormats();
|
$supported_formats = PhabricatorFile::getTransformableImageFormats();
|
||||||
|
|
||||||
|
@ -327,7 +327,7 @@ final class ConpherenceUpdateController
|
||||||
->setAfterMessageID($latest_transaction_id)
|
->setAfterMessageID($latest_transaction_id)
|
||||||
->needHeaderPics(true)
|
->needHeaderPics(true)
|
||||||
->needWidgetData(true)
|
->needWidgetData(true)
|
||||||
->needAllTransactions(true)
|
->needTransactions(true)
|
||||||
->withIDs(array($conpherence_id))
|
->withIDs(array($conpherence_id))
|
||||||
->executeOne();
|
->executeOne();
|
||||||
|
|
||||||
|
@ -358,10 +358,8 @@ final class ConpherenceUpdateController
|
||||||
'nav_item' => hsprintf('%s', $nav_item),
|
'nav_item' => hsprintf('%s', $nav_item),
|
||||||
'conpherence_phid' => $conpherence->getPHID(),
|
'conpherence_phid' => $conpherence->getPHID(),
|
||||||
'header' => hsprintf('%s', $header),
|
'header' => hsprintf('%s', $header),
|
||||||
|
'file_widget' => $file_widget->render(),
|
||||||
// TODO: Fix these.
|
'people_widget' => $people_widget->render()
|
||||||
// 'file_widget' => $file_widget->render(),
|
|
||||||
// 'people_widget' => $people_widget->render()
|
|
||||||
);
|
);
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ final class ConpherenceViewController extends
|
||||||
->setViewer($user)
|
->setViewer($user)
|
||||||
->withIDs(array($conpherence_id))
|
->withIDs(array($conpherence_id))
|
||||||
->needHeaderPics(true)
|
->needHeaderPics(true)
|
||||||
->needAllTransactions(true)
|
->needTransactions(true)
|
||||||
->executeOne();
|
->executeOne();
|
||||||
$this->setConpherence($conpherence);
|
$this->setConpherence($conpherence);
|
||||||
|
|
||||||
|
@ -105,7 +105,6 @@ final class ConpherenceViewController extends
|
||||||
->setWorkflow(true)
|
->setWorkflow(true)
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->addHiddenInput('action', 'message')
|
->addHiddenInput('action', 'message')
|
||||||
->addHiddenInput('latest_transaction_id', $latest_transaction_id)
|
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new PhabricatorRemarkupControl())
|
id(new PhabricatorRemarkupControl())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
|
@ -113,6 +112,19 @@ final class ConpherenceViewController extends
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormSubmitControl())
|
id(new AphrontFormSubmitControl())
|
||||||
->setValue(pht('Pontificate')))
|
->setValue(pht('Pontificate')))
|
||||||
|
->appendChild(
|
||||||
|
javelin_tag(
|
||||||
|
'input',
|
||||||
|
array(
|
||||||
|
'type' => 'hidden',
|
||||||
|
'name' => 'latest_transaction_id',
|
||||||
|
'value' => $latest_transaction_id,
|
||||||
|
'sigil' => 'latest-transaction-id',
|
||||||
|
'meta' => array(
|
||||||
|
'id' => $latest_transaction_id
|
||||||
|
)
|
||||||
|
),
|
||||||
|
''))
|
||||||
->render();
|
->render();
|
||||||
|
|
||||||
$scrollbutton = javelin_tag(
|
$scrollbutton = javelin_tag(
|
||||||
|
|
|
@ -50,7 +50,6 @@ final class ConpherenceWidgetController extends
|
||||||
->setViewer($user)
|
->setViewer($user)
|
||||||
->withIDs(array($conpherence_id))
|
->withIDs(array($conpherence_id))
|
||||||
->needWidgetData(true)
|
->needWidgetData(true)
|
||||||
->needAllTransactions(true)
|
|
||||||
->executeOne();
|
->executeOne();
|
||||||
$this->setConpherence($conpherence);
|
$this->setConpherence($conpherence);
|
||||||
|
|
||||||
|
@ -69,11 +68,6 @@ final class ConpherenceWidgetController extends
|
||||||
Javelin::initBehavior(
|
Javelin::initBehavior(
|
||||||
'conpherence-widget-pane',
|
'conpherence-widget-pane',
|
||||||
array(
|
array(
|
||||||
'header' => 'conpherence-header-pane',
|
|
||||||
'messages' => 'conpherence-messages',
|
|
||||||
'people_widget' => 'widgets-people',
|
|
||||||
'file_widget' => 'widgets-files',
|
|
||||||
'settings_widget' => 'widgets-settings',
|
|
||||||
'widgetRegistery' => array(
|
'widgetRegistery' => array(
|
||||||
'widgets-conpherence-list' => $cant_toggle,
|
'widgets-conpherence-list' => $cant_toggle,
|
||||||
'widgets-conversation' => $cant_toggle,
|
'widgets-conversation' => $cant_toggle,
|
||||||
|
@ -174,22 +168,24 @@ final class ConpherenceWidgetController extends
|
||||||
)));
|
)));
|
||||||
$user = $this->getRequest()->getUser();
|
$user = $this->getRequest()->getUser();
|
||||||
// now the widget bodies
|
// now the widget bodies
|
||||||
$widgets[] = phutil_tag(
|
$widgets[] = javelin_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => 'widgets-body',
|
'class' => 'widgets-body',
|
||||||
'id' => 'widgets-people',
|
'id' => 'widgets-people',
|
||||||
|
'sigil' => 'widgets-people',
|
||||||
'style' => 'display: none;'
|
'style' => 'display: none;'
|
||||||
),
|
),
|
||||||
id(new ConpherencePeopleWidgetView())
|
id(new ConpherencePeopleWidgetView())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->setConpherence($conpherence)
|
->setConpherence($conpherence)
|
||||||
->setUpdateURI($this->getWidgetURI()));
|
->setUpdateURI($this->getWidgetURI()));
|
||||||
$widgets[] = phutil_tag(
|
$widgets[] = javelin_tag(
|
||||||
'div',
|
'div',
|
||||||
array(
|
array(
|
||||||
'class' => 'widgets-body',
|
'class' => 'widgets-body',
|
||||||
'id' => 'widgets-files',
|
'id' => 'widgets-files',
|
||||||
|
'sigil' => 'widgets-files',
|
||||||
),
|
),
|
||||||
id(new ConpherenceFileWidgetView())
|
id(new ConpherenceFileWidgetView())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
|
@ -257,10 +253,10 @@ final class ConpherenceWidgetController extends
|
||||||
'name' => 'action',
|
'name' => 'action',
|
||||||
'value' => 'notifications'
|
'value' => 'notifications'
|
||||||
)),
|
)),
|
||||||
javelin_tag(
|
phutil_tag(
|
||||||
'button',
|
'button',
|
||||||
array(
|
array(
|
||||||
'sigil' => 'notifications-update',
|
'type' => 'submit',
|
||||||
'class' => 'notifications-update grey',
|
'class' => 'notifications-update grey',
|
||||||
),
|
),
|
||||||
pht('Update Notifications'))
|
pht('Update Notifications'))
|
||||||
|
@ -271,6 +267,7 @@ final class ConpherenceWidgetController extends
|
||||||
array(
|
array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'action' => $this->getWidgetURI(),
|
'action' => $this->getWidgetURI(),
|
||||||
|
'sigil' => 'notifications-update',
|
||||||
),
|
),
|
||||||
$layout);
|
$layout);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,9 +11,21 @@ final class ConpherenceThreadQuery
|
||||||
private $needWidgetData;
|
private $needWidgetData;
|
||||||
private $needHeaderPics;
|
private $needHeaderPics;
|
||||||
private $needOrigPics;
|
private $needOrigPics;
|
||||||
private $needAllTransactions;
|
private $needTransactions;
|
||||||
|
private $needParticipantCache;
|
||||||
|
private $needFilePHIDs;
|
||||||
private $afterMessageID;
|
private $afterMessageID;
|
||||||
|
|
||||||
|
public function needFilePHIDs($need_file_phids) {
|
||||||
|
$this->needFilePHIDs = $need_file_phids;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function needParticipantCache($participant_cache) {
|
||||||
|
$this->needParticipantCache = $participant_cache;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
public function needOrigPics($need_orig_pics) {
|
public function needOrigPics($need_orig_pics) {
|
||||||
$this->needOrigPics = $need_orig_pics;
|
$this->needOrigPics = $need_orig_pics;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -29,8 +41,8 @@ final class ConpherenceThreadQuery
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function needAllTransactions($need_all_transactions) {
|
public function needTransactions($need_transactions) {
|
||||||
$this->needAllTransactions = $need_all_transactions;
|
$this->needTransactions = $need_transactions;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,14 +78,18 @@ final class ConpherenceThreadQuery
|
||||||
|
|
||||||
if ($conpherences) {
|
if ($conpherences) {
|
||||||
$conpherences = mpull($conpherences, null, 'getPHID');
|
$conpherences = mpull($conpherences, null, 'getPHID');
|
||||||
$this->loadParticipants($conpherences);
|
$this->loadParticipantsAndInitHandles($conpherences);
|
||||||
|
if ($this->needParticipantCache) {
|
||||||
if ($this->needAllTransactions) {
|
$this->loadCoreHandles($conpherences, 'getRecentParticipantPHIDs');
|
||||||
|
} else if ($this->needWidgetData) {
|
||||||
|
$this->loadCoreHandles($conpherences, 'getParticipantPHIDs');
|
||||||
|
}
|
||||||
|
if ($this->needTransactions) {
|
||||||
$this->loadTransactionsAndHandles($conpherences);
|
$this->loadTransactionsAndHandles($conpherences);
|
||||||
}
|
}
|
||||||
|
if ($this->needFilePHIDs || $this->needWidgetData) {
|
||||||
$this->loadFilePHIDs($conpherences);
|
$this->loadFilePHIDs($conpherences);
|
||||||
|
}
|
||||||
if ($this->needWidgetData) {
|
if ($this->needWidgetData) {
|
||||||
$this->loadWidgetData($conpherences);
|
$this->loadWidgetData($conpherences);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +126,7 @@ final class ConpherenceThreadQuery
|
||||||
return $this->formatWhereClause($where);
|
return $this->formatWhereClause($where);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function loadParticipants(array $conpherences) {
|
private function loadParticipantsAndInitHandles(array $conpherences) {
|
||||||
$participants = id(new ConpherenceParticipant())
|
$participants = id(new ConpherenceParticipant())
|
||||||
->loadAllWhere('conpherencePHID IN (%Ls)', array_keys($conpherences));
|
->loadAllWhere('conpherencePHID IN (%Ls)', array_keys($conpherences));
|
||||||
$map = mgroup($participants, 'getConpherencePHID');
|
$map = mgroup($participants, 'getConpherencePHID');
|
||||||
|
@ -121,11 +137,32 @@ final class ConpherenceThreadQuery
|
||||||
null,
|
null,
|
||||||
'getParticipantPHID');
|
'getParticipantPHID');
|
||||||
$current_conpherence->attachParticipants($conpherence_participants);
|
$current_conpherence->attachParticipants($conpherence_participants);
|
||||||
|
$current_conpherence->attachHandles(array());
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function loadCoreHandles(
|
||||||
|
array $conpherences,
|
||||||
|
$method) {
|
||||||
|
|
||||||
|
$handle_phids = array();
|
||||||
|
foreach ($conpherences as $conpherence) {
|
||||||
|
$handle_phids[$conpherence->getPHID()] =
|
||||||
|
$conpherence->$method();
|
||||||
|
}
|
||||||
|
$flat_phids = array_mergev($handle_phids);
|
||||||
|
$handles = id(new PhabricatorObjectHandleData($flat_phids))
|
||||||
|
->setViewer($this->getViewer())
|
||||||
|
->loadHandles();
|
||||||
|
foreach ($handle_phids as $conpherence_phid => $phids) {
|
||||||
|
$conpherence = $conpherences[$conpherence_phid];
|
||||||
|
$conpherence->attachHandles(array_select_keys($handles, $phids));
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
private function loadTransactionsAndHandles(array $conpherences) {
|
private function loadTransactionsAndHandles(array $conpherences) {
|
||||||
$transactions = id(new ConpherenceTransactionQuery())
|
$transactions = id(new ConpherenceTransactionQuery())
|
||||||
->setViewer($this->getViewer())
|
->setViewer($this->getViewer())
|
||||||
|
@ -141,7 +178,7 @@ final class ConpherenceThreadQuery
|
||||||
foreach ($current_transactions as $transaction) {
|
foreach ($current_transactions as $transaction) {
|
||||||
$handles += $transaction->getHandles();
|
$handles += $transaction->getHandles();
|
||||||
}
|
}
|
||||||
$conpherence->attachHandles($handles);
|
$conpherence->attachHandles($conpherence->getHandles() + $handles);
|
||||||
$conpherence->attachTransactions($transactions[$phid]);
|
$conpherence->attachTransactions($transactions[$phid]);
|
||||||
}
|
}
|
||||||
return $this;
|
return $this;
|
||||||
|
|
|
@ -173,107 +173,51 @@ final class ConpherenceThread extends ConpherenceDAO
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDisplayData(PhabricatorUser $user, $size) {
|
public function getDisplayData(PhabricatorUser $user, $size) {
|
||||||
$transactions = $this->getTransactions();
|
$recent_phids = $this->getRecentParticipantPHIDs();
|
||||||
|
|
||||||
$handles = $this->getHandles();
|
$handles = $this->getHandles();
|
||||||
// we don't want to show the user unless they are babbling to themselves
|
|
||||||
if (count($handles) > 1) {
|
// luck has little to do with it really; most recent participant who isn't
|
||||||
unset($handles[$user->getPHID()]);
|
// the user....
|
||||||
|
$lucky_phid = null;
|
||||||
|
$lucky_index = null;
|
||||||
|
foreach ($recent_phids as $index => $phid) {
|
||||||
|
if ($phid == $user->getPHID()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$lucky_phid = $phid;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
reset($recent_phids);
|
||||||
|
|
||||||
|
if ($lucky_phid) {
|
||||||
|
$lucky_handle = $handles[$lucky_phid];
|
||||||
|
// this will be just the user talking to themselves. weirdos.
|
||||||
|
} else {
|
||||||
|
$lucky_handle = reset($handles);
|
||||||
}
|
}
|
||||||
|
|
||||||
$participants = $this->getParticipants();
|
|
||||||
$user_participation = $participants[$user->getPHID()];
|
|
||||||
$latest_transaction = null;
|
|
||||||
$title = $this->getTitle();
|
$title = $this->getTitle();
|
||||||
$subtitle = '';
|
if (!$title) {
|
||||||
$img_src = null;
|
$title = $lucky_handle->getName();
|
||||||
$img_class = null;
|
}
|
||||||
if ($this->getImagePHID($size)) {
|
|
||||||
|
$image = $this->getImagePHID($size);
|
||||||
|
if ($image) {
|
||||||
$img_src = $this->getImage($size)->getBestURI();
|
$img_src = $this->getImage($size)->getBestURI();
|
||||||
$img_class = 'custom-';
|
$img_class = 'custom-';
|
||||||
}
|
|
||||||
$unread_count = 0;
|
|
||||||
$max_count = 10;
|
|
||||||
$snippet = null;
|
|
||||||
if (!$user_participation->isUpToDate()) {
|
|
||||||
$behind_transaction_phid =
|
|
||||||
$user_participation->getBehindTransactionPHID();
|
|
||||||
} else {
|
} else {
|
||||||
$behind_transaction_phid = null;
|
$img_src = $lucky_handle->getImageURI();
|
||||||
}
|
$img_class = null;
|
||||||
foreach (array_reverse($transactions) as $transaction) {
|
|
||||||
switch ($transaction->getTransactionType()) {
|
|
||||||
case ConpherenceTransactionType::TYPE_PARTICIPANTS:
|
|
||||||
case ConpherenceTransactionType::TYPE_TITLE:
|
|
||||||
case ConpherenceTransactionType::TYPE_PICTURE:
|
|
||||||
continue 2;
|
|
||||||
case PhabricatorTransactions::TYPE_COMMENT:
|
|
||||||
if ($snippet === null) {
|
|
||||||
$snippet = phutil_utf8_shorten(
|
|
||||||
$transaction->getComment()->getContent(),
|
|
||||||
48);
|
|
||||||
if ($transaction->getAuthorPHID() == $user->getPHID()) {
|
|
||||||
$snippet = "\xE2\x86\xB0 " . $snippet;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// fallthrough intentionally here
|
|
||||||
case ConpherenceTransactionType::TYPE_FILES:
|
|
||||||
if (!$latest_transaction) {
|
|
||||||
$latest_transaction = $transaction;
|
|
||||||
}
|
|
||||||
$latest_participant_phid = $transaction->getAuthorPHID();
|
|
||||||
if ((!$title || !$img_src) &&
|
|
||||||
$latest_participant_phid != $user->getPHID()) {
|
|
||||||
$latest_handle = $handles[$latest_participant_phid];
|
|
||||||
if (!$img_src) {
|
|
||||||
$img_src = $latest_handle->getImageURI();
|
|
||||||
}
|
|
||||||
if (!$title) {
|
|
||||||
$title = $latest_handle->getName();
|
|
||||||
// (maybs) used the pic, definitely used the name -- discard
|
|
||||||
unset($handles[$latest_participant_phid]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($behind_transaction_phid) {
|
|
||||||
$unread_count++;
|
|
||||||
if ($transaction->getPHID() == $behind_transaction_phid) {
|
|
||||||
break 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($unread_count > $max_count) {
|
|
||||||
break 2;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
continue 2;
|
|
||||||
}
|
|
||||||
if ($snippet && !$behind_transaction_phid) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($unread_count > $max_count) {
|
|
||||||
$unread_count = $max_count.'+';
|
|
||||||
}
|
|
||||||
|
|
||||||
// This happens if the user has been babbling, maybs just to themselves,
|
|
||||||
// but enough un-responded to transactions for our SQL limit would
|
|
||||||
// hit this too... Also happens on new threads since only the first
|
|
||||||
// author has participated.
|
|
||||||
// ...so just pick a different handle in these cases.
|
|
||||||
$some_handle = reset($handles);
|
|
||||||
if (!$img_src) {
|
|
||||||
$img_src = $some_handle->getImageURI();
|
|
||||||
}
|
|
||||||
if (!$title) {
|
|
||||||
$title = $some_handle->getName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$count = 0;
|
$count = 0;
|
||||||
$final = false;
|
$final = false;
|
||||||
foreach ($handles as $handle) {
|
$subtitle = null;
|
||||||
if ($handle->getType() != PhabricatorPHIDConstants::PHID_TYPE_USER) {
|
foreach ($recent_phids as $phid) {
|
||||||
|
if ($phid == $user->getPHID()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
$handle = $handles[$phid];
|
||||||
if ($subtitle) {
|
if ($subtitle) {
|
||||||
if ($final) {
|
if ($final) {
|
||||||
$subtitle .= '...';
|
$subtitle .= '...';
|
||||||
|
@ -287,14 +231,18 @@ final class ConpherenceThread extends ConpherenceDAO
|
||||||
$final = $count == 3;
|
$final = $count == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$participants = $this->getParticipants();
|
||||||
|
$user_participation = $participants[$user->getPHID()];
|
||||||
|
$unread_count = $this->getMessageCount() -
|
||||||
|
$user_participation->getSeenMessageCount();
|
||||||
|
|
||||||
return array(
|
return array(
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'subtitle' => $subtitle,
|
'subtitle' => $subtitle,
|
||||||
'unread_count' => $unread_count,
|
'unread_count' => $unread_count,
|
||||||
'epoch' => $latest_transaction->getDateCreated(),
|
'epoch' => $this->getDateModified(),
|
||||||
'image' => $img_src,
|
'image' => $img_src,
|
||||||
'image_class' => $img_class,
|
'image_class' => $img_class,
|
||||||
'snippet' => $snippet,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ final class ConpherenceMenuItemView extends AphrontTagView {
|
||||||
private $subtitle;
|
private $subtitle;
|
||||||
private $imageURI;
|
private $imageURI;
|
||||||
private $href;
|
private $href;
|
||||||
private $messageText;
|
|
||||||
private $epoch;
|
private $epoch;
|
||||||
private $unreadCount;
|
private $unreadCount;
|
||||||
|
|
||||||
|
@ -21,14 +20,6 @@ final class ConpherenceMenuItemView extends AphrontTagView {
|
||||||
return $this->unreadCount;
|
return $this->unreadCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMessageText($message_text) {
|
|
||||||
$this->messageText = $message_text;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
public function getMessageText() {
|
|
||||||
return $this->messageText;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function setEpoch($epoch) {
|
public function setEpoch($epoch) {
|
||||||
$this->epoch = $epoch;
|
$this->epoch = $epoch;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -111,15 +102,6 @@ final class ConpherenceMenuItemView extends AphrontTagView {
|
||||||
),
|
),
|
||||||
$this->subtitle);
|
$this->subtitle);
|
||||||
}
|
}
|
||||||
$message = null;
|
|
||||||
if ($this->messageText) {
|
|
||||||
$message = phutil_tag(
|
|
||||||
'span',
|
|
||||||
array(
|
|
||||||
'class' => 'conpherence-menu-item-message-text'
|
|
||||||
),
|
|
||||||
$this->messageText);
|
|
||||||
}
|
|
||||||
$epoch = null;
|
$epoch = null;
|
||||||
if ($this->epoch) {
|
if ($this->epoch) {
|
||||||
$epoch = phutil_tag(
|
$epoch = phutil_tag(
|
||||||
|
@ -143,7 +125,6 @@ final class ConpherenceMenuItemView extends AphrontTagView {
|
||||||
$image,
|
$image,
|
||||||
$title,
|
$title,
|
||||||
$subtitle,
|
$subtitle,
|
||||||
$message,
|
|
||||||
$epoch,
|
$epoch,
|
||||||
$unread_count,
|
$unread_count,
|
||||||
);
|
);
|
||||||
|
|
|
@ -18,6 +18,10 @@ final class ConpherencePeopleWidgetView extends ConpherenceWidgetView {
|
||||||
array(
|
array(
|
||||||
'method' => 'POST',
|
'method' => 'POST',
|
||||||
'action' => $this->getUpdateURI(),
|
'action' => $this->getUpdateURI(),
|
||||||
|
'sigil' => 'add-person',
|
||||||
|
'meta' => array(
|
||||||
|
'action' => 'add_person'
|
||||||
|
)
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
id(new AphrontFormTokenizerControl())
|
id(new AphrontFormTokenizerControl())
|
||||||
|
@ -26,15 +30,11 @@ final class ConpherencePeopleWidgetView extends ConpherenceWidgetView {
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
->setDatasource('/typeahead/common/users/')
|
->setDatasource('/typeahead/common/users/')
|
||||||
->setLimit(1),
|
->setLimit(1),
|
||||||
javelin_tag(
|
phutil_tag(
|
||||||
'button',
|
'button',
|
||||||
array(
|
array(
|
||||||
'sigil' => 'add-person',
|
'type' => 'submit',
|
||||||
'class' => 'people-add-button',
|
'class' => 'people-add-button',
|
||||||
'meta' => array(
|
|
||||||
'action' => 'add_person',
|
|
||||||
'latest_transaction_id' => $this->getLatestTransactionID()
|
|
||||||
)
|
|
||||||
),
|
),
|
||||||
pht('Add'))
|
pht('Add'))
|
||||||
));
|
));
|
||||||
|
@ -73,7 +73,6 @@ final class ConpherencePeopleWidgetView extends ConpherenceWidgetView {
|
||||||
'meta' => array(
|
'meta' => array(
|
||||||
'remove_person' => $handle->getPHID(),
|
'remove_person' => $handle->getPHID(),
|
||||||
'action' => 'remove_person',
|
'action' => 'remove_person',
|
||||||
'latest_transaction_id' => $this->getLatestTransactionID()
|
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
phutil_tag(
|
phutil_tag(
|
||||||
|
@ -105,6 +104,5 @@ final class ConpherencePeopleWidgetView extends ConpherenceWidgetView {
|
||||||
}
|
}
|
||||||
|
|
||||||
return array($header, $body);
|
return array($header, $body);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,6 @@ final class ConpherenceThreadListView extends AphrontView {
|
||||||
$unread_count = $data['unread_count'];
|
$unread_count = $data['unread_count'];
|
||||||
$epoch = $data['epoch'];
|
$epoch = $data['epoch'];
|
||||||
$image = $data['image'];
|
$image = $data['image'];
|
||||||
$snippet = $data['snippet'];
|
|
||||||
|
|
||||||
return id(new ConpherenceMenuItemView())
|
return id(new ConpherenceMenuItemView())
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
|
@ -75,7 +74,6 @@ final class ConpherenceThreadListView extends AphrontView {
|
||||||
->setHref($uri)
|
->setHref($uri)
|
||||||
->setEpoch($epoch)
|
->setEpoch($epoch)
|
||||||
->setImageURI($image)
|
->setImageURI($image)
|
||||||
->setMessageText($snippet)
|
|
||||||
->setUnreadCount($unread_count)
|
->setUnreadCount($unread_count)
|
||||||
->setID($thread->getPHID().'-nav-item')
|
->setID($thread->getPHID().'-nav-item')
|
||||||
->addSigil('conpherence-menu-click')
|
->addSigil('conpherence-menu-click')
|
||||||
|
|
|
@ -23,11 +23,4 @@ abstract class ConpherenceWidgetView extends AphrontView {
|
||||||
public function getConpherence() {
|
public function getConpherence() {
|
||||||
return $this->conpherence;
|
return $this->conpherence;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLatestTransactionID() {
|
|
||||||
$transactions = $this->getConpherence()->getTransactions();
|
|
||||||
$latest = end($transactions);
|
|
||||||
return $latest->getID();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ div.conpherence-layout .phabricator-nav-column-background {
|
||||||
|
|
||||||
.conpherence-menu .conpherence-menu-item-view {
|
.conpherence-menu .conpherence-menu-item-view {
|
||||||
display: block;
|
display: block;
|
||||||
height: 70px;
|
height: 55px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -84,45 +84,37 @@ div.conpherence-layout .phabricator-nav-column-background {
|
||||||
left: 6px;
|
left: 6px;
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
width: 50px;
|
width: 35px;
|
||||||
height: 50px;
|
height: 35px;
|
||||||
|
background-size: 35px;
|
||||||
border: 4px solid rgb(29, 32, 34);
|
border: 4px solid rgb(29, 32, 34);
|
||||||
border-radius: 2px;
|
border-radius: 3px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.conpherence-menu .conpherence-menu-item-view .conpherence-menu-item-title {
|
.conpherence-menu .conpherence-menu-item-view .conpherence-menu-item-title {
|
||||||
display: block;
|
display: block;
|
||||||
margin-top: 12px;
|
margin-top: 12px;
|
||||||
margin-left: 70px;
|
margin-left: 58px;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
font-size: 12px;
|
font-size: 13px;
|
||||||
color: #ffffff;
|
color: #ffffff;
|
||||||
text-shadow: 0px 1px 1px #000000;
|
text-shadow: 0px 1px 1px #000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
.conpherence-menu .conpherence-menu-item-view .conpherence-menu-item-subtitle {
|
.conpherence-menu .conpherence-menu-item-view .conpherence-menu-item-subtitle {
|
||||||
display: block;
|
display: block;
|
||||||
color: #bfbfbf;
|
color: #a1a5a9;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
margin-left: 70px;
|
margin-left: 58px;
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
}
|
}
|
||||||
|
|
||||||
.conpherence-menu .conpherence-menu-item-view
|
|
||||||
.conpherence-menu-item-message-text {
|
|
||||||
display: block;
|
|
||||||
color: #66CCFF;
|
|
||||||
font-size: 12px;
|
|
||||||
margin-top: 4px;
|
|
||||||
margin-left: 70px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.conpherence-menu .conpherence-menu-item-view
|
.conpherence-menu .conpherence-menu-item-view
|
||||||
.conpherence-menu-item-unread-count {
|
.conpherence-menu-item-unread-count {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 48px;
|
left: 35px;
|
||||||
top: 3px;
|
top: 3px;
|
||||||
background: #f00;
|
background: #f00;
|
||||||
border-radius: 10px;
|
border-radius: 10px;
|
||||||
|
@ -140,10 +132,10 @@ div.conpherence-layout .phabricator-nav-column-background {
|
||||||
|
|
||||||
.conpherence-menu .conpherence-menu-item-view .conpherence-menu-item-date {
|
.conpherence-menu .conpherence-menu-item-view .conpherence-menu-item-date {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 10px;
|
top: 15px;
|
||||||
right: 12px;
|
right: 16px;
|
||||||
color: white;
|
color: #a1a5a9;
|
||||||
font-size: 12px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.no-conpherences-menu-item {
|
.no-conpherences-menu-item {
|
||||||
|
|
|
@ -337,7 +337,7 @@
|
||||||
clear: none;
|
clear: none;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
width: 166px;
|
width: 164px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.conpherence-widget-pane .person-entry .pic {
|
.conpherence-widget-pane .person-entry .pic {
|
||||||
|
|
|
@ -29,13 +29,12 @@ JX.behavior('conpherence-menu', function(config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectthread(node) {
|
function selectthread(node) {
|
||||||
if (node === thread.node) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (thread.node) {
|
if (thread.node) {
|
||||||
JX.DOM.alterClass(thread.node, 'conpherence-selected', false);
|
JX.DOM.alterClass(thread.node, 'conpherence-selected', false);
|
||||||
JX.DOM.alterClass(thread.node, 'hide-unread-count', false);
|
// keep the unread-count hidden still. big TODO once we ajax in updates
|
||||||
|
// to threads to make this work right and move threads between read /
|
||||||
|
// unread
|
||||||
}
|
}
|
||||||
|
|
||||||
JX.DOM.alterClass(node, 'conpherence-selected', true);
|
JX.DOM.alterClass(node, 'conpherence-selected', true);
|
||||||
|
@ -47,10 +46,18 @@ JX.behavior('conpherence-menu', function(config) {
|
||||||
thread.selected = data.id;
|
thread.selected = data.id;
|
||||||
|
|
||||||
JX.History.replace(config.base_uri + data.id + '/');
|
JX.History.replace(config.base_uri + data.id + '/');
|
||||||
|
|
||||||
redrawthread();
|
redrawthread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JX.Stratcom.listen(
|
||||||
|
'conpherence-selectthread',
|
||||||
|
null,
|
||||||
|
function (e) {
|
||||||
|
var node = JX.$(e.getData().id);
|
||||||
|
selectthread(node);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
function redrawthread() {
|
function redrawthread() {
|
||||||
if (!thread.node) {
|
if (!thread.node) {
|
||||||
return;
|
return;
|
||||||
|
@ -67,6 +74,8 @@ JX.behavior('conpherence-menu', function(config) {
|
||||||
new JX.Workflow(uri, {})
|
new JX.Workflow(uri, {})
|
||||||
.setHandler(onresponse)
|
.setHandler(onresponse)
|
||||||
.start();
|
.start();
|
||||||
|
} else {
|
||||||
|
didredrawthread();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thread.visible !== null || !config.hasWidgets) {
|
if (thread.visible !== null || !config.hasWidgets) {
|
||||||
|
@ -183,7 +192,6 @@ JX.behavior('conpherence-menu', function(config) {
|
||||||
|
|
||||||
if (!config.hasThreadList) {
|
if (!config.hasThreadList) {
|
||||||
loadthreads();
|
loadthreads();
|
||||||
didredrawthread();
|
|
||||||
} else {
|
} else {
|
||||||
didloadthreads();
|
didloadthreads();
|
||||||
}
|
}
|
||||||
|
@ -192,7 +200,6 @@ JX.behavior('conpherence-menu', function(config) {
|
||||||
JX.Stratcom.listen('phabricator-device-change', null, ondevicechange);
|
JX.Stratcom.listen('phabricator-device-change', null, ondevicechange);
|
||||||
ondevicechange();
|
ondevicechange();
|
||||||
|
|
||||||
|
|
||||||
function loadthreads() {
|
function loadthreads() {
|
||||||
var uri = config.base_uri + 'thread/' + config.selectedID + '/';
|
var uri = config.base_uri + 'thread/' + config.selectedID + '/';
|
||||||
new JX.Workflow(uri)
|
new JX.Workflow(uri)
|
||||||
|
@ -221,7 +228,6 @@ JX.behavior('conpherence-menu', function(config) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
redrawthread();
|
redrawthread();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,12 @@ JX.behavior('conpherence-pontificate', function(config) {
|
||||||
var root = e.getNode('conpherence-layout');
|
var root = e.getNode('conpherence-layout');
|
||||||
var messages = JX.DOM.find(root, 'div', 'conpherence-messages');
|
var messages = JX.DOM.find(root, 'div', 'conpherence-messages');
|
||||||
var header = JX.DOM.find(root, 'div', 'conpherence-header');
|
var header = JX.DOM.find(root, 'div', 'conpherence-header');
|
||||||
|
var fileWidget = null;
|
||||||
|
try {
|
||||||
|
fileWidget = JX.DOM.find(root, 'div', 'widgets-files');
|
||||||
|
} catch (ex) {
|
||||||
|
// Ignore; maybe no files widget
|
||||||
|
}
|
||||||
|
|
||||||
JX.Workflow.newFromForm(form)
|
JX.Workflow.newFromForm(form)
|
||||||
.setHandler(JX.bind(this, function(r) {
|
.setHandler(JX.bind(this, function(r) {
|
||||||
|
@ -25,16 +31,28 @@ JX.behavior('conpherence-pontificate', function(config) {
|
||||||
JX.DOM.setContent(header, JX.$H(r.header));
|
JX.DOM.setContent(header, JX.$H(r.header));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
var node = JX.$(r.conpherence_phid + '-nav-item');
|
||||||
JX.DOM.replace(
|
JX.DOM.replace(
|
||||||
JX.$(r.conpherence_phid + '-nav-item'),
|
node,
|
||||||
JX.$H(r.nav_item));
|
JX.$H(r.nav_item));
|
||||||
|
JX.Stratcom.invoke(
|
||||||
|
'conpherence-selectthread',
|
||||||
|
null,
|
||||||
|
{ id : r.conpherence_phid + '-nav-item' }
|
||||||
|
);
|
||||||
} catch (ex) {
|
} catch (ex) {
|
||||||
// Ignore; this view may not have a menu.
|
// Ignore; this view may not have a menu.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fileWidget) {
|
||||||
|
JX.DOM.setContent(
|
||||||
|
fileWidget,
|
||||||
|
JX.$H(r.file_widget)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
var inputs = JX.DOM.scry(form, 'input');
|
var inputs = JX.DOM.scry(form, 'input');
|
||||||
for (var ii = 0; ii < inputs.length; ii++) {
|
for (var ii = 0; ii < inputs.length; ii++) {
|
||||||
JX.log(inputs[ii]);
|
|
||||||
if (inputs[ii].name == 'latest_transaction_id') {
|
if (inputs[ii].name == 'latest_transaction_id') {
|
||||||
inputs[ii].value = r.latest_transaction_id;
|
inputs[ii].value = r.latest_transaction_id;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -40,65 +40,76 @@ JX.behavior('conpherence-widget-pane', function(config) {
|
||||||
);
|
);
|
||||||
|
|
||||||
/* people widget */
|
/* people widget */
|
||||||
var peopleRoot = JX.$(config.people_widget);
|
JX.Stratcom.listen(
|
||||||
var peopleUpdateHandler = function (r) {
|
['submit', 'didSyntheticSubmit'],
|
||||||
// update the transactions
|
|
||||||
var messages = JX.$(config.messages);
|
|
||||||
JX.DOM.appendContent(messages, JX.$H(r.transactions));
|
|
||||||
messages.scrollTop = messages.scrollHeight;
|
|
||||||
|
|
||||||
// update the menu entry as well
|
|
||||||
JX.DOM.replace(
|
|
||||||
JX.$(r.conpherence_phid + '-nav-item'),
|
|
||||||
JX.$H(r.nav_item)
|
|
||||||
);
|
|
||||||
|
|
||||||
// update the header
|
|
||||||
JX.DOM.setContent(
|
|
||||||
JX.$(config.header),
|
|
||||||
JX.$H(r.header)
|
|
||||||
);
|
|
||||||
|
|
||||||
// update the people widget
|
|
||||||
JX.DOM.setContent(
|
|
||||||
JX.$(config.people_widget),
|
|
||||||
JX.$H(r.people_widget)
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
JX.DOM.listen(
|
|
||||||
peopleRoot,
|
|
||||||
['click'],
|
|
||||||
'add-person',
|
'add-person',
|
||||||
function (e) {
|
function (e) {
|
||||||
e.kill();
|
e.kill();
|
||||||
var form = JX.DOM.find(peopleRoot, 'form');
|
var root = e.getNode('conpherence-layout');
|
||||||
|
var form = e.getNode('tag:form');
|
||||||
var data = e.getNodeData('add-person');
|
var data = e.getNodeData('add-person');
|
||||||
|
var peopleRoot = e.getNode('widgets-people');
|
||||||
|
var messages = JX.DOM.find(root, 'div', 'conpherence-messages');
|
||||||
|
var header = JX.DOM.find(root, 'div', 'conpherence-header');
|
||||||
|
var latestTransactionData = JX.Stratcom.getData(
|
||||||
|
JX.DOM.find(
|
||||||
|
root,
|
||||||
|
'input',
|
||||||
|
'latest-transaction-id'
|
||||||
|
));
|
||||||
|
data.latest_transaction_id = latestTransactionData.id;
|
||||||
JX.Workflow.newFromForm(form, data)
|
JX.Workflow.newFromForm(form, data)
|
||||||
.setHandler(peopleUpdateHandler)
|
.setHandler(JX.bind(this, function (r) {
|
||||||
|
// update the transactions
|
||||||
|
JX.DOM.appendContent(messages, JX.$H(r.transactions));
|
||||||
|
messages.scrollTop = messages.scrollHeight;
|
||||||
|
|
||||||
|
try {
|
||||||
|
JX.DOM.replace(
|
||||||
|
JX.$(r.conpherence_phid + '-nav-item'),
|
||||||
|
JX.$H(r.nav_item));
|
||||||
|
JX.Stratcom.invoke(
|
||||||
|
'conpherence-selectthread',
|
||||||
|
null,
|
||||||
|
{ id : r.conpherence_phid + '-nav-item' }
|
||||||
|
);
|
||||||
|
} catch (ex) {
|
||||||
|
// Ignore; this view may not have a menu.
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the header
|
||||||
|
JX.DOM.setContent(
|
||||||
|
header,
|
||||||
|
JX.$H(r.header)
|
||||||
|
);
|
||||||
|
|
||||||
|
// update the people widget
|
||||||
|
JX.DOM.setContent(
|
||||||
|
peopleRoot,
|
||||||
|
JX.$H(r.people_widget)
|
||||||
|
);
|
||||||
|
}))
|
||||||
.start();
|
.start();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
JX.DOM.listen(
|
JX.Stratcom.listen(
|
||||||
peopleRoot,
|
|
||||||
['click'],
|
['click'],
|
||||||
'remove-person',
|
'remove-person',
|
||||||
function (e) {
|
function (e) {
|
||||||
|
var peopleRoot = e.getNode('widgets-people');
|
||||||
var form = JX.DOM.find(peopleRoot, 'form');
|
var form = JX.DOM.find(peopleRoot, 'form');
|
||||||
var data = e.getNodeData('remove-person');
|
var data = e.getNodeData('remove-person');
|
||||||
|
// we end up re-directing to conpherence home
|
||||||
JX.Workflow.newFromForm(form, data)
|
JX.Workflow.newFromForm(form, data)
|
||||||
.setHandler(peopleUpdateHandler)
|
|
||||||
.start();
|
.start();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
/* settings widget */
|
/* settings widget */
|
||||||
var settingsRoot = JX.$(config.settings_widget);
|
|
||||||
|
|
||||||
var onsubmitSettings = function (e) {
|
var onsubmitSettings = function (e) {
|
||||||
e.kill();
|
e.kill();
|
||||||
var form = JX.DOM.find(settingsRoot, 'form');
|
var form = e.getNode('tag:form');
|
||||||
var button = JX.DOM.find(form, 'button');
|
var button = JX.DOM.find(form, 'button');
|
||||||
JX.Workflow.newFromForm(form)
|
JX.Workflow.newFromForm(form)
|
||||||
.setHandler(JX.bind(this, function (r) {
|
.setHandler(JX.bind(this, function (r) {
|
||||||
|
@ -112,9 +123,8 @@ JX.behavior('conpherence-widget-pane', function(config) {
|
||||||
.start();
|
.start();
|
||||||
};
|
};
|
||||||
|
|
||||||
JX.DOM.listen(
|
JX.Stratcom.listen(
|
||||||
settingsRoot,
|
['submit', 'didSyntheticSubmit'],
|
||||||
['click'],
|
|
||||||
'notifications-update',
|
'notifications-update',
|
||||||
onsubmitSettings
|
onsubmitSettings
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue