Skip to content

Commit

Permalink
Merge branch '3.3-dev' into goal-card
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron authored Oct 14, 2024
2 parents 942af41 + b216f3c commit 6b7ad59
Show file tree
Hide file tree
Showing 16 changed files with 193 additions and 338 deletions.
30 changes: 13 additions & 17 deletions app/Domain/Auth/Templates/includes/loginInfo.blade.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
@dispatchEvent('beforeUserinfoMenuOpen')
<div class="userinfo">
<div class="">
@dispatchEvent('afterUserinfoMenuOpen')

<x-global::actions.dropdown contentRole='ghost' position="left">
<x-global::actions.dropdown content-role='ghost' scale="md" position="end">
<x-slot:labelText>
@if(session()->exists("companysettings.logoPath") && session("companysettings.logoPath") !== false)
<a href="{{ BASE_URL }}/users/editOwn/">
<img src="{{ BASE_URL }}/api/users?profileImage={{ $user['id'] ?? -1 }}&v={{ format($user['modified'] ?? -1)->timestamp() }}" class="profilePicture"/>
<img src="{{ BASE_URL }}/api/users?profileImage={{ $user['id'] ?? -1 }}&v={{ format($user['modified'] ?? -1)->timestamp() }}"
/>
<img src="{{ session("companysettings.logoPath") }}" class="logo"/>
<i class="fa fa-caret-down" aria-hidden="true"></i>
</a>
@else
<a href="{{ BASE_URL }}/users/editOwn/" class="profileHandler">
<img src="{{ BASE_URL }}/api/users?profileImage={{ $user['id'] ?? -1 }}&v={{ format($user['modified'] ?? -1)->timestamp() }}" class="profilePicture"/>
<i class="fa fa-caret-down" aria-hidden="true"></i>
</a>
<img src="{{ BASE_URL }}/api/users?profileImage={{ $user['id'] ?? -1 }}&v={{ format($user['modified'] ?? -1)->timestamp() }}"
/>
@endif
</x-slot:labeltext>

<x-slot:menu>
<x-global::actions.dropdown.item>
<x-global::actions.dropdown.item variant='list-item'>
<a href='{{ BASE_URL }}/users/editOwn/'>
{!! __("menu.my_profile") !!}
</a>
</x-global::actions.dropdown.item>
<x-global::actions.dropdown.item>
<x-global::actions.dropdown.item variant='list-item'>
<a href='{{ BASE_URL }}/users/editOwn#theme'>
{!! __("menu.theme") !!}
</a>
</x-global::actions.dropdown.item>
<x-global::actions.dropdown.item>
<x-global::actions.dropdown.item variant='list-item'>
<a href='{{ BASE_URL }}/users/editOwn#settings'>
{!! __("menu.settings") !!}
</a>
Expand All @@ -38,22 +34,22 @@
<x-global::actions.dropdown.item class="nav-header border">
{!! __("menu.help_support") !!}
</x-global::actions.dropdown.item>
<x-global::actions.dropdown.item>
<x-global::actions.dropdown.item variant='list-item'>
<a href='javascript:void(0);' onclick="leantime.helperController.showHelperModal('{{ $modal }}', 300, 500);">
{!! __("menu.what_is_this_page") !!}
</a>
</x-global::actions.dropdown.item>
<x-global::actions.dropdown.item>
<x-global::actions.dropdown.item variant='list-item'>
<a href='https://leantime.io/knowledge-base' target="_blank">
{!! __("menu.knowledge_base") !!}
</a>
</x-global::actions.dropdown.item>
<x-global::actions.dropdown.item>
<x-global::actions.dropdown.item variant='list-item'>
<a href='https://discord.gg/4zMzJtAq9z' target="_blank">
{!! __("menu.community") !!}
</a>
</x-global::actions.dropdown.item>
<x-global::actions.dropdown.item>
<x-global::actions.dropdown.item variant='list-item'>
<a href='https://leantime.io/contact-us' target="_blank">
{!! __("menu.contact_us") !!}
</a>
Expand Down
6 changes: 4 additions & 2 deletions app/Domain/Auth/Templates/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@
<?php if ($tpl->get('oidcEnabled')) { ?>
<?php $tpl->dispatchTplEvent('beforeOidcButton'); ?>
<div class="">
<br /><center class="uppercase"><?php echo $tpl->language->__("label.or"); ?></center><br />

<?php if (false === $tpl->get('noLoginForm')) { ?>
<br /><center class="uppercase"><?php echo $tpl->language->__("label.or"); ?></center><br />
<?php } ?>

<x-global::forms.button onclick="window.location.href = '{{ BASE_URL }}/oidc/login'" content-role="primary" name="oidclogin" class="w-full">
{{ $tpl->language->__('buttons.oidclogin') }}
</x-global::forms.button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,13 @@ class="w-1/2"
<div class="col-md-3">
<x-global::forms.text-input type="number" step="0.01" name="startValue"
value="{{ $canvasItem['startValue'] }}" labelText="{{ __('label.starting_value') }}"
variant="compact"
class="w-5" />

</div>
<div class="col-md-3">
<x-global::forms.text-input type="number" step="0.01" name="currentValue"
id="currentValueField" value="{{ $canvasItem['currentValue'] }}"
labelText="{{ __('label.current_value') }}" variant="compact"
labelText="{{ __('label.current_value') }}"
class="w-5"

{{-- @if ($canvasItem['setting'] == 'linkAndReport')--}}
Expand All @@ -71,9 +70,7 @@ class="w-5"
<div class="col-md-3">
<x-global::forms.text-input type="number" step="0.01" name="endValue"
value="{{ $canvasItem['endValue'] }}" labelText="{{ __('label.goal_value') }}"

class="w-5"
variant="compact" />
class="w-5"/>

</div>
<div class="col-md-3">
Expand Down
5 changes: 3 additions & 2 deletions app/Domain/Ideas/Controllers/IdeaDialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ public function post($params): Response
return Frontcontroller::redirect($result['redirect']);
}

$this->tpl->assign('canvasTypes', $result['canvasTypes']);
$this->tpl->assign('canvasItem', $result['canvasItem']);

$this->tpl->assign('canvasTypes', $result['canvasTypes']??'');
$this->tpl->assign('canvasItem', $result['canvasItem']??'');

$this->tpl->closeModal();
$this->tpl->htmxRefresh();
Expand Down
2 changes: 1 addition & 1 deletion app/Domain/Oidc/Controllers/Callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function get($params): Response
} catch (\Exception $e) {
$this->tpl->setNotification($e->getMessage(), 'danger', 'oidc_error');

return Frontcontroller::redirect(BASE_URL.'/oidc/login');
return Frontcontroller::redirect(BASE_URL.'/auth/login');
}
}
}
8 changes: 6 additions & 2 deletions app/Domain/Oidc/Services/Oidc.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,14 @@ public function callback(string $code, string $state): Response
//echo '<pre>' . print_r($tokens, true) . '</pre>';
if (isset($tokens['id_token'])) {
$userInfo = $this->decodeJWT($tokens['id_token']);
} elseif (isset($tokens['access_token'])) {
}

if ($userInfo == null && isset($tokens['access_token'])) {
//falback to OAuth userinfo endpoint
$userInfo = $this->pollUserInfo($tokens['access_token']);
} else {
}

if ((!isset($tokens['access_token'])) && (!isset($tokens['access_token']))) {
$this->displayError('oidc.error.unsupportedToken');
}

Expand Down
161 changes: 74 additions & 87 deletions app/Domain/Projects/Services/Projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,39 +213,38 @@ public function getUsersToNotify($projectId): array
return $to;
}

/**
* @api
*/
public function getAllUserInfoToNotify($projectId): array
{
/**
* @api
*/
public function getAllUserInfoToNotify($projectId): array
{

$users = $this->projectRepository->getUsersAssignedToProject($projectId);
$users = $this->projectRepository->getUsersAssignedToProject($projectId);

$to = [];
$to = [];

//Only users that actually want to be notified
foreach ($users as $user) {
if ($user['notifications'] != 0 && ($user['username'] != session('userdata.mail'))) {
$to[] = $user;
}
}
//Only users that actually want to be notified
foreach ($users as $user) {
if ($user['notifications'] != 0 && ($user['username'] != session('userdata.mail'))) {
$to[] = $user;
}
}

return $to;
return $to;
}

//TODO Split and move to notifications

/**
* @throws BindingResolutionException
*
* @api
*/
public function notifyProjectUsers(Notification $notification): void
{

//Filter notifications
/**
* @throws BindingResolutionException
*
* @api
*/
public function notifyProjectUsers(Notification $notification): void
{

$notification = self::dispatchFilter('notificationFilter', $notification);
//Filter notifications
$notification = self::dispatchFilter('notificationFilter', $notification);

//Email
$users = $this->getUsersToNotify($notification->projectId);
Expand All @@ -255,22 +254,10 @@ public function notifyProjectUsers(Notification $notification): void
return $user != $notification->authorId;
}, ARRAY_FILTER_USE_BOTH);

/*
$mailer = app()->make(MailerCore::class);
$mailer->setContext('notify_project_users');
$mailer->setSubject($notification->subject);
$mailer->setHtml($emailMessage);
//$mailer->sendMail($users, session("userdata.name"));
*
* @api
*/

$emailMessage = $notification->message;
if ($notification->url !== false) {
$emailMessage .= " <a href='".$notification->url['url']."'>".$notification->url['text'].'</a>';
}
$emailMessage = $notification->message;
if ($notification->url !== false) {
$emailMessage .= " <a href='".$notification->url['url']."'>".$notification->url['text'].'</a>';
}

// NEW Queuing messaging system
$queue = app()->make(QueueRepository::class);
Expand All @@ -279,68 +266,68 @@ public function notifyProjectUsers(Notification $notification): void
//Send to messengers
$this->messengerService->sendNotificationToMessengers($notification, $projectName);

//Notify users about mentions
//Fields that should be parsed for mentions
$mentionFields = [
'comments' => ['text'],
'projects' => ['details'],
'tickets' => ['description'],
'canvas' => ['description', 'data', 'conclusion', 'assumptions'],
];
//Notify users about mentions
//Fields that should be parsed for mentions
$mentionFields = [
'comments' => ['text'],
'projects' => ['details'],
'tickets' => ['description'],
'canvas' => ['description', 'data', 'conclusion', 'assumptions'],
];

$contentToCheck = '';
//Find entity ID & content
//Todo once all entities are models this if statement can be reduced
if (isset($notification->entity) && is_array($notification->entity) && isset($notification->entity['id'])) {
$entityId = $notification->entity['id'];
$contentToCheck = '';
//Find entity ID & content
//Todo once all entities are models this if statement can be reduced
if (isset($notification->entity) && is_array($notification->entity) && isset($notification->entity['id'])) {
$entityId = $notification->entity['id'];

if (isset($mentionFields[$notification->module])) {
$fields = $mentionFields[$notification->module];
if (isset($mentionFields[$notification->module])) {
$fields = $mentionFields[$notification->module];

foreach ($fields as $field) {
if (isset($notification->entity[$field])) {
$contentToCheck .= $notification->entity[$field];
}
foreach ($fields as $field) {
if (isset($notification->entity[$field])) {
$contentToCheck .= $notification->entity[$field];
}
}
} elseif (isset($notification->entity) && is_object($notification->entity) && isset($notification->entity->id)) {
$entityId = $notification->entity->id;
}
} elseif (isset($notification->entity) && is_object($notification->entity) && isset($notification->entity->id)) {
$entityId = $notification->entity->id;

if (isset($mentionFields[$notification->module])) {
$fields = $mentionFields[$notification->module];
if (isset($mentionFields[$notification->module])) {
$fields = $mentionFields[$notification->module];

foreach ($fields as $field) {
if (isset($notification->entity->$field)) {
$contentToCheck .= $notification->entity->$field;
}
foreach ($fields as $field) {
if (isset($notification->entity->$field)) {
$contentToCheck .= $notification->entity->$field;
}
}
} else {
//Entity id not set use project id
$entityId = $notification->projectId;
}
} else {
//Entity id not set use project id
$entityId = $notification->projectId;
}

if ($contentToCheck != '') {
$this->notificationService->processMentions(
$contentToCheck,
$notification->module,
(int) $entityId,
$notification->authorId,
$notification->url['url']
);
}

self::dispatchEvent('notifyProjectUsers', ['type' => 'projectUpdate', 'module' => $notification->module, 'moduleId' => $entityId, 'message' => $notification->message, 'subject' => $notification->subject, 'users' => $this->getAllUserInfoToNotify($notification->projectId), 'url' => $notification->url['url']], 'domain.services.projects');
if ($contentToCheck != '') {
$this->notificationService->processMentions(
$contentToCheck,
$notification->module,
(int) $entityId,
$notification->authorId,
$notification->url['url']
);
}

/**
* @param $projectId
* @return mixed|void
*
self::dispatchEvent('notifyProjectUsers', ['type' => 'projectUpdate', 'module' => $notification->module, 'moduleId' => $entityId, 'message' => $notification->message, 'subject' => $notification->subject, 'users' => $this->getAllUserInfoToNotify($notification->projectId), 'url' => $notification->url['url']], 'domain.services.projects');
}

/**
* @param $projectId
* @return mixed|void
*
* @api
*/
public function getProjectName($projectId)
{
public function getProjectName($projectId)
{

$project = $this->projectRepository->getProject($projectId);
if ($project) {
Expand Down
2 changes: 1 addition & 1 deletion app/Domain/Projects/Templates/showProject.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class="fa fa-user-plus"></span>
<h4 class="widgettitle title-light"><span class="fa fa-leaf"></span>Slack</h4>
<div class="row">
<div class="col-md-3">
<img src="https://cdn.cdnlogo.com/logos/s/52/slack.svg" width="200" />
<img src="<?=BASE_URL ?>/dist/images/slack.svg" width="200"/>
</div>

<div class="col-md-5">
Expand Down
Loading

0 comments on commit 6b7ad59

Please sign in to comment.