mirror of
https://we.phorge.it/source/phorge.git
synced 2025-02-04 02:48:25 +01:00
75abf79953
Summary: Fixes T12215. Two issues: - We build this `$session` link out of `$ip`, which is (a) wrong even if `$ip` was the IP and (b) super wrong since `$ip` is a tag. - These links don't work even if we'd built them right: searching by the //prefix// of a session identifier does nothing. At least for now, just get rid of the links rather than trying to make this behavior work. Test Plan: On People > Activity logs: - Before patch: Saw bad links with bogus targets in "session" column. - After patch: Saw plain text in "session" column. Reviewers: chad Reviewed By: chad Maniphest Tasks: T12215 Differential Revision: https://secure.phabricator.com/D17316
88 lines
1.9 KiB
PHP
88 lines
1.9 KiB
PHP
<?php
|
|
|
|
final class PhabricatorUserLogView extends AphrontView {
|
|
|
|
private $logs;
|
|
private $handles;
|
|
private $searchBaseURI;
|
|
|
|
public function setSearchBaseURI($search_base_uri) {
|
|
$this->searchBaseURI = $search_base_uri;
|
|
return $this;
|
|
}
|
|
|
|
public function setLogs(array $logs) {
|
|
assert_instances_of($logs, 'PhabricatorUserLog');
|
|
$this->logs = $logs;
|
|
return $this;
|
|
}
|
|
|
|
public function setHandles(array $handles) {
|
|
assert_instances_of($handles, 'PhabricatorObjectHandle');
|
|
$this->handles = $handles;
|
|
return $this;
|
|
}
|
|
|
|
public function render() {
|
|
$logs = $this->logs;
|
|
$handles = $this->handles;
|
|
$viewer = $this->getUser();
|
|
|
|
$action_map = PhabricatorUserLog::getActionTypeMap();
|
|
$base_uri = $this->searchBaseURI;
|
|
|
|
$rows = array();
|
|
foreach ($logs as $log) {
|
|
$ip = $log->getRemoteAddr();
|
|
$session = substr($log->getSession(), 0, 6);
|
|
|
|
if ($base_uri) {
|
|
$ip = phutil_tag(
|
|
'a',
|
|
array(
|
|
'href' => $base_uri.'?ip='.$ip.'#R',
|
|
),
|
|
$ip);
|
|
}
|
|
|
|
$action = $log->getAction();
|
|
$action_name = idx($action_map, $action, $action);
|
|
|
|
$rows[] = array(
|
|
phabricator_date($log->getDateCreated(), $viewer),
|
|
phabricator_time($log->getDateCreated(), $viewer),
|
|
$action_name,
|
|
$log->getActorPHID()
|
|
? $handles[$log->getActorPHID()]->getName()
|
|
: null,
|
|
$username = $handles[$log->getUserPHID()]->renderLink(),
|
|
$ip,
|
|
$session,
|
|
);
|
|
}
|
|
|
|
$table = new AphrontTableView($rows);
|
|
$table->setHeaders(
|
|
array(
|
|
pht('Date'),
|
|
pht('Time'),
|
|
pht('Action'),
|
|
pht('Actor'),
|
|
pht('User'),
|
|
pht('IP'),
|
|
pht('Session'),
|
|
));
|
|
$table->setColumnClasses(
|
|
array(
|
|
'',
|
|
'right',
|
|
'wide',
|
|
'',
|
|
'',
|
|
'',
|
|
'n',
|
|
));
|
|
|
|
return $table;
|
|
}
|
|
}
|