Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2894916
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
2 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/applications/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php b/src/applications/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php
index a7653e74b5..129538f49b 100644
--- a/src/applications/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php
+++ b/src/applications/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php
@@ -1,81 +1,81 @@
<?php
final class PhabricatorAphlictManagementNotifyWorkflow
extends PhabricatorAphlictManagementWorkflow {
protected function didConstruct() {
$this
->setName('notify')
->setSynopsis(pht('Send a notification to a user.'))
->setArguments(
array(
array(
'name' => 'user',
'param' => 'username',
'help' => pht('User to notify.'),
),
array(
'name' => 'message',
'param' => 'text',
'help' => pht('Message to send.'),
),
));
}
public function execute(PhutilArgumentParser $args) {
$viewer = $this->getViewer();
$username = $args->getArg('user');
- if (!strlen($username)) {
+ if (!phutil_nonempty_string($username)) {
throw new PhutilArgumentUsageException(
pht(
'Specify a user to notify with "--user".'));
}
$user = id(new PhabricatorPeopleQuery())
->setViewer($viewer)
->withUsernames(array($username))
->executeOne();
if (!$user) {
throw new PhutilArgumentUsageException(
pht(
'No user with username "%s" exists.',
$username));
}
$message = $args->getArg('message');
- if (!strlen($message)) {
+ if (!phutil_nonempty_string($message)) {
throw new PhutilArgumentUsageException(
pht(
'Specify a message to send with "--message".'));
}
$application_phid = id(new PhabricatorNotificationsApplication())
->getPHID();
$content_source = $this->newContentSource();
$xactions = array();
$xactions[] = id(new PhabricatorUserTransaction())
->setTransactionType(
PhabricatorUserNotifyTransaction::TRANSACTIONTYPE)
->setNewValue($message)
->setForceNotifyPHIDs(array($user->getPHID()));
$editor = id(new PhabricatorUserTransactionEditor())
->setActor($viewer)
->setActingAsPHID($application_phid)
->setContentSource($content_source);
$editor->applyTransactions($user, $xactions);
echo tsprintf(
"%s\n",
pht('Sent notification.'));
return 0;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Jan 19 2025, 20:42 (6 w, 1 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1128536
Default Alt Text
(2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment