Remove "Former" project members
Summary: This is a needlessly confusing/complex feature that I originally wrote sort of speculativley. I think we can better serve what little need may exist here with project feeds. I'm probably going to get rid of or deemphasize "role" too and just add "Join Project" and "Leave Project" buttons. Test Plan: Viewed project list, project profile. Edited project profile and affiliation. Reviewers: btrahan, jungejason, zeeg Reviewed By: btrahan CC: aran, btrahan Maniphest Tasks: T681 Differential Revision: 1228
This commit is contained in:
1
resources/sql/patches/086.formeraffil.sql
Normal file
1
resources/sql/patches/086.formeraffil.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE phabricator_project.project_affiliation DROP status;
|
||||||
@@ -48,7 +48,6 @@ class PhabricatorProjectAffiliationEditController
|
|||||||
|
|
||||||
if ($request->isFormPost()) {
|
if ($request->isFormPost()) {
|
||||||
$affiliation->setRole($request->getStr('role'));
|
$affiliation->setRole($request->getStr('role'));
|
||||||
$affiliation->setStatus($request->getStr('status'));
|
|
||||||
|
|
||||||
if (!strlen($affiliation->getRole())) {
|
if (!strlen($affiliation->getRole())) {
|
||||||
if ($affiliation->getID()) {
|
if ($affiliation->getID()) {
|
||||||
@@ -67,11 +66,6 @@ class PhabricatorProjectAffiliationEditController
|
|||||||
->setURI('/project/view/'.$project->getID().'/');
|
->setURI('/project/view/'.$project->getID().'/');
|
||||||
}
|
}
|
||||||
|
|
||||||
$status_options = array(
|
|
||||||
'' => 'Current',
|
|
||||||
'former' => 'Former',
|
|
||||||
);
|
|
||||||
|
|
||||||
$form = new AphrontFormView();
|
$form = new AphrontFormView();
|
||||||
$form
|
$form
|
||||||
->setUser($user)
|
->setUser($user)
|
||||||
@@ -81,12 +75,6 @@ class PhabricatorProjectAffiliationEditController
|
|||||||
->setLabel('Role')
|
->setLabel('Role')
|
||||||
->setName('role')
|
->setName('role')
|
||||||
->setValue($affiliation->getRole()))
|
->setValue($affiliation->getRole()))
|
||||||
->appendChild(
|
|
||||||
id(new AphrontFormSelectControl())
|
|
||||||
->setLabel('Status')
|
|
||||||
->setName('status')
|
|
||||||
->setOptions($status_options)
|
|
||||||
->setValue($affiliation->getStatus()))
|
|
||||||
->appendChild(
|
->appendChild(
|
||||||
id(new AphrontFormSubmitControl())
|
id(new AphrontFormSubmitControl())
|
||||||
->addCancelButton('/project/view/'.$project->getID().'/')
|
->addCancelButton('/project/view/'.$project->getID().'/')
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ phutil_require_module('phabricator', 'applications/project/controller/base');
|
|||||||
phutil_require_module('phabricator', 'applications/project/storage/affiliation');
|
phutil_require_module('phabricator', 'applications/project/storage/affiliation');
|
||||||
phutil_require_module('phabricator', 'applications/project/storage/project');
|
phutil_require_module('phabricator', 'applications/project/storage/project');
|
||||||
phutil_require_module('phabricator', 'view/form/base');
|
phutil_require_module('phabricator', 'view/form/base');
|
||||||
phutil_require_module('phabricator', 'view/form/control/select');
|
|
||||||
phutil_require_module('phabricator', 'view/form/control/submit');
|
phutil_require_module('phabricator', 'view/form/control/submit');
|
||||||
phutil_require_module('phabricator', 'view/form/control/text');
|
phutil_require_module('phabricator', 'view/form/control/text');
|
||||||
phutil_require_module('phabricator', 'view/layout/panel');
|
phutil_require_module('phabricator', 'view/layout/panel');
|
||||||
|
|||||||
@@ -132,13 +132,7 @@ class PhabricatorProjectProfileController
|
|||||||
foreach ($affiliations as $affiliation) {
|
foreach ($affiliations as $affiliation) {
|
||||||
$user = $handles[$affiliation->getUserPHID()]->renderLink();
|
$user = $handles[$affiliation->getUserPHID()]->renderLink();
|
||||||
$role = phutil_escape_html($affiliation->getRole());
|
$role = phutil_escape_html($affiliation->getRole());
|
||||||
|
$affiliated[] = '<li>'.$user.' — '.$role.'</li>';
|
||||||
$status = null;
|
|
||||||
if ($affiliation->getStatus() == 'former') {
|
|
||||||
$role = '<em>Former '.$role.'</em>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$affiliated[] = '<li>'.$user.' — '.$role.$status.'</li>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($affiliated) {
|
if ($affiliated) {
|
||||||
|
|||||||
@@ -113,7 +113,6 @@ class PhabricatorProjectProfileEditController
|
|||||||
}
|
}
|
||||||
$state[$user_phid] = array(
|
$state[$user_phid] = array(
|
||||||
'phid' => $user_phid,
|
'phid' => $user_phid,
|
||||||
'status' => $resource['status'],
|
|
||||||
'role' => $resource['role'],
|
'role' => $resource['role'],
|
||||||
'owner' => $resource['owner'],
|
'owner' => $resource['owner'],
|
||||||
);
|
);
|
||||||
@@ -141,7 +140,6 @@ class PhabricatorProjectProfileEditController
|
|||||||
}
|
}
|
||||||
|
|
||||||
$affil->setRole((string)$new['role']);
|
$affil->setRole((string)$new['role']);
|
||||||
$affil->setStatus((string)$new['status']);
|
|
||||||
$affil->setIsOwner((int)$new['owner']);
|
$affil->setIsOwner((int)$new['owner']);
|
||||||
|
|
||||||
$save_affiliations[] = $affil;
|
$save_affiliations[] = $affil;
|
||||||
@@ -180,7 +178,6 @@ class PhabricatorProjectProfileEditController
|
|||||||
$state[] = array(
|
$state[] = array(
|
||||||
'phid' => $user_phid,
|
'phid' => $user_phid,
|
||||||
'name' => $handles[$user_phid]->getFullName(),
|
'name' => $handles[$user_phid]->getFullName(),
|
||||||
'status' => $affil->getStatus(),
|
|
||||||
'role' => $affil->getRole(),
|
'role' => $affil->getRole(),
|
||||||
'owner' => $affil->getIsOwner(),
|
'owner' => $affil->getIsOwner(),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ final class PhabricatorProjectQuery {
|
|||||||
|
|
||||||
$data = queryfx_all(
|
$data = queryfx_all(
|
||||||
$conn_r,
|
$conn_r,
|
||||||
'SELECT * FROM %T p %Q %Q',
|
'SELECT p.* FROM %T p %Q %Q',
|
||||||
$table->getTableName(),
|
$table->getTableName(),
|
||||||
$joins,
|
$joins,
|
||||||
$limit);
|
$limit);
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ class PhabricatorProjectAffiliation extends PhabricatorProjectDAO {
|
|||||||
protected $projectPHID;
|
protected $projectPHID;
|
||||||
protected $userPHID;
|
protected $userPHID;
|
||||||
protected $role;
|
protected $role;
|
||||||
protected $status = '';
|
|
||||||
protected $isOwner = 0;
|
protected $isOwner = 0;
|
||||||
|
|
||||||
public static function loadAllForProjectPHIDs($phids) {
|
public static function loadAllForProjectPHIDs($phids) {
|
||||||
@@ -31,7 +30,7 @@ class PhabricatorProjectAffiliation extends PhabricatorProjectDAO {
|
|||||||
$default = array_fill_keys($phids, array());
|
$default = array_fill_keys($phids, array());
|
||||||
|
|
||||||
$affiliations = id(new PhabricatorProjectAffiliation())->loadAllWhere(
|
$affiliations = id(new PhabricatorProjectAffiliation())->loadAllWhere(
|
||||||
'projectPHID IN (%Ls) ORDER BY IF(status = "former", 1, 0), dateCreated',
|
'projectPHID IN (%Ls) ORDER BY dateCreated',
|
||||||
$phids);
|
$phids);
|
||||||
|
|
||||||
return mgroup($affiliations, 'getProjectPHID') + $default;
|
return mgroup($affiliations, 'getProjectPHID') + $default;
|
||||||
|
|||||||
@@ -40,10 +40,6 @@ JX.behavior('projects-resource-editor', function(config) {
|
|||||||
tokenizer.addToken(data.phid, data.name);
|
tokenizer.addToken(data.phid, data.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
var status = JX.Prefab.renderSelect(
|
|
||||||
{'' : 'Current', 'former' : 'Former'},
|
|
||||||
data.status || '');
|
|
||||||
|
|
||||||
var role = JX.$N('input', {type: 'text', value : data.role || ''});
|
var role = JX.$N('input', {type: 'text', value : data.role || ''});
|
||||||
|
|
||||||
var ownership = JX.Prefab.renderSelect(
|
var ownership = JX.Prefab.renderSelect(
|
||||||
@@ -54,7 +50,6 @@ JX.behavior('projects-resource-editor', function(config) {
|
|||||||
var tokens = tokenizer.getTokens();
|
var tokens = tokenizer.getTokens();
|
||||||
return {
|
return {
|
||||||
phid : JX.keys(tokens)[0] || null,
|
phid : JX.keys(tokens)[0] || null,
|
||||||
status : status.value,
|
|
||||||
role : role.value,
|
role : role.value,
|
||||||
owner : ownership.value
|
owner : ownership.value
|
||||||
};
|
};
|
||||||
@@ -64,7 +59,6 @@ JX.behavior('projects-resource-editor', function(config) {
|
|||||||
r.push([null, JX.$N('label', {}, 'User:')]);
|
r.push([null, JX.$N('label', {}, 'User:')]);
|
||||||
r.push(['user-tokenizer', template]);
|
r.push(['user-tokenizer', template]);
|
||||||
r.push(['role-label', JX.$N('label', {}, 'Role:')]);
|
r.push(['role-label', JX.$N('label', {}, 'Role:')]);
|
||||||
r.push([null, status]);
|
|
||||||
r.push(['role', role]);
|
r.push(['role', role]);
|
||||||
r.push([null, ownership]);
|
r.push([null, ownership]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user