Skip to content

Commit

Permalink
Enh #257: Add "Send message" to People cards - update with Humhub 1.11
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-farre committed Apr 4, 2022
1 parent f41aee7 commit 9846a6f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Changelog
- Fix #252: Fix wrong user guid in Live Notification
- Fix #251: Fix edit message
- Enh #257: Add "Send message" to People cards
- Chg: Update min HumHub version to v1.11

2.1.0 (December 7, 2021)
-------------------------
Expand Down
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"keywords": ["mail", "messaging", "communication"],
"version": "2.1.1",
"humhub": {
"minVersion": "1.10"
"minVersion": "1.11"
},
"homepage": "https://github.com/humhub/humhub-modules-mail",
"authors": [
Expand Down
21 changes: 4 additions & 17 deletions widgets/PeopleActionButtonsMail.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,25 @@

namespace humhub\modules\mail\widgets;

use humhub\modules\friendship\widgets\FriendshipButton;
use humhub\modules\mail\Module;
use humhub\modules\ui\icon\widgets\Icon;
use humhub\modules\user\widgets\PeopleActionButtons;
use humhub\modules\user\widgets\UserFollowButton;
use humhub\widgets\BootstrapComponent;
use Yii;

class PeopleActionButtonsMail extends PeopleActionButtons
{
public function run()
{
$html = UserFollowButton::widget([
'user' => $this->user,
'followOptions' => ['class' => 'btn btn-primary btn-sm'],
'unfollowOptions' => ['class' => 'btn btn-primary btn-sm active'],
]);

$html .= FriendshipButton::widget([
'user' => $this->user,
'options' => [
'friends' => ['attrs' => ['class' => 'btn btn-info btn-sm active']],
'addFriend' => ['attrs' => ['class' => 'btn btn-info btn-sm']],
'acceptFriendRequest' => ['attrs' => ['class' => 'btn btn-info btn-sm active'], 'togglerClass' => 'btn btn-info btn-sm active'],
'cancelFriendRequest' => ['attrs' => ['class' => 'btn btn-info btn-sm active']],
],
]);
$html = $this->addFollowButton();
$html .= $this->addFriendshipButton();

/** @var Module $module */
$module = Yii::$app->getModule('mail');

if ($module->showSendMessageButtonInPeopleCards) {
$html .= NewMessageButton::widget([
'label' => Icon::get('send') . ' ' . Yii::t('MailModule.base', 'Message'),
'guid' => $this->user->guid,
'type' => BootstrapComponent::TYPE_DEFAULT,
]);
Expand Down

0 comments on commit 9846a6f

Please sign in to comment.