当前位置: 首页>>代码示例>>PHP>>正文


PHP PhabricatorUser::getIsMailingList方法代码示例

本文整理汇总了PHP中PhabricatorUser::getIsMailingList方法的典型用法代码示例。如果您正苦于以下问题:PHP PhabricatorUser::getIsMailingList方法的具体用法?PHP PhabricatorUser::getIsMailingList怎么用?PHP PhabricatorUser::getIsMailingList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhabricatorUser的用法示例。


在下文中一共展示了PhabricatorUser::getIsMailingList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildUserInformationDictionary

 protected function buildUserInformationDictionary(PhabricatorUser $user, $with_email = false, $with_availability = false)
 {
     $roles = array();
     if ($user->getIsDisabled()) {
         $roles[] = 'disabled';
     }
     if ($user->getIsSystemAgent()) {
         $roles[] = 'agent';
     }
     if ($user->getIsMailingList()) {
         $roles[] = 'list';
     }
     if ($user->getIsAdmin()) {
         $roles[] = 'admin';
     }
     $primary = $user->loadPrimaryEmail();
     if ($primary && $primary->getIsVerified()) {
         $email = $primary->getAddress();
         $roles[] = 'verified';
     } else {
         $email = null;
         $roles[] = 'unverified';
     }
     if ($user->getIsApproved()) {
         $roles[] = 'approved';
     }
     if ($user->isUserActivated()) {
         $roles[] = 'activated';
     }
     $return = array('phid' => $user->getPHID(), 'userName' => $user->getUserName(), 'realName' => $user->getRealName(), 'image' => $user->getProfileImageURI(), 'uri' => PhabricatorEnv::getURI('/p/' . $user->getUsername() . '/'), 'roles' => $roles);
     if ($with_email) {
         $return['primaryEmail'] = $email;
     }
     if ($with_availability) {
         // TODO: Modernize this once we have a more long-term view of what the
         // data looks like.
         $until = $user->getAwayUntil();
         if ($until) {
             $return['currentStatus'] = 'away';
             $return['currentStatusUntil'] = $until;
         }
     }
     return $return;
 }
开发者ID:pugong,项目名称:phabricator,代码行数:44,代码来源:UserConduitAPIMethod.php

示例2: makeMailingListUser

 /**
  * @task role
  */
 public function makeMailingListUser(PhabricatorUser $user, $mailing_list)
 {
     $actor = $this->requireActor();
     if (!$user->getID()) {
         throw new Exception(pht('User has not been created yet!'));
     }
     $user->openTransaction();
     $user->beginWriteLocking();
     $user->reload();
     if ($user->getIsMailingList() == $mailing_list) {
         $user->endWriteLocking();
         $user->killTransaction();
         return $this;
     }
     $log = PhabricatorUserLog::initializeNewLog($actor, $user->getPHID(), PhabricatorUserLog::ACTION_MAILING_LIST);
     $log->setOldValue($user->getIsMailingList());
     $log->setNewValue($mailing_list);
     $user->setIsMailingList((int) $mailing_list);
     $user->save();
     $log->save();
     $user->endWriteLocking();
     $user->saveTransaction();
     return $this;
 }
开发者ID:truSense,项目名称:phabricator,代码行数:27,代码来源:PhabricatorUserEditor.php


注:本文中的PhabricatorUser::getIsMailingList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。