3 Commits

Author SHA1 Message Date
Sebastian 8a18494883 feat: show disabled accounts
Signed-off-by: Sebastian <krupinski01@gmail.com>
2026-07-28 20:52:13 -04:00
Sebastian 0a2a87acfa fix: auto selected sending account when only once available
Signed-off-by: Sebastian <krupinski01@gmail.com>
2026-07-28 13:10:01 -04:00
Sebastian 436197fbfe refactor: migrate to scoped execution contexts
Signed-off-by: Sebastian <krupinski01@gmail.com>
2026-07-27 00:52:28 -04:00
4 changed files with 24 additions and 27 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
services:
mongo:
image: mongo:8
image: mongo:7
options: >-
--health-cmd "mongosh --quiet --eval \"db.adminCommand('ping')\""
--health-interval 5s
+6 -6
View File
@@ -7,8 +7,8 @@ namespace KTXM\Mail\Controllers;
use InvalidArgumentException;
use KTXC\Http\Response\JsonResponse;
use KTXC\Http\Response\Response;
use KTXC\SessionIdentity;
use KTXC\SessionTenant;
use KTXC\Context\IdentityContextInterface;
use KTXC\Context\TenantContextInterface;
use KTXF\Controller\ControllerAbstract;
use KTXF\Routing\Attributes\AuthenticatedRoute;
use KTXM\Mail\CompositionManager;
@@ -18,8 +18,8 @@ use Throwable;
final class CompositionController extends ControllerAbstract {
public function __construct(
private readonly SessionTenant $tenantIdentity,
private readonly SessionIdentity $userIdentity,
private readonly TenantContextInterface $tenantContext,
private readonly IdentityContextInterface $identityContext,
private readonly CompositionManager $compositionManager,
private readonly LoggerInterface $logger,
) {}
@@ -31,8 +31,8 @@ final class CompositionController extends ControllerAbstract {
string|null $operation = null,
array|null $data = null,
): Response {
$tenantId = $this->tenantIdentity->identifier();
$userId = $this->userIdentity->identifier();
$tenantId = $this->tenantContext->identifier();
$userId = $this->identityContext->identifier();
try {
if ($operation === null) {
+14 -18
View File
@@ -1,6 +1,6 @@
<script setup lang="ts">
import type { ComposerSenderIdentity } from '@/types/composer';
import { computed } from 'vue'
import { computed, watch } from 'vue'
interface Props {
modelValue: ComposerSenderIdentity | null
@@ -27,11 +27,6 @@ const items = computed<SenderListItem[]>(() => {
const selectedValue = computed(() => props.modelValue?.address ?? null)
const singleOptionLabel = computed(() => {
const onlyOption = props.options[0]
return onlyOption ? formatSenderLabel(onlyOption.label, onlyOption.address) : ''
})
const errorMessages = computed(() => {
if (props.options.length === 0) {
return ['No send-capable account is available.']
@@ -40,6 +35,18 @@ const errorMessages = computed(() => {
return []
})
// Auto-select (and keep selected) the only send-capable account, since
// there's no "from" UI shown for the user to pick it themselves.
watch(
() => props.options,
options => {
if (options.length === 1 && props.modelValue?.address !== options[0].address) {
emit('update:modelValue', options[0])
}
},
{ immediate: true },
)
function handleUpdate(value: string | null) {
const match = value ? props.options.find(o => o.address === value) ?? null : null
emit('update:modelValue', match)
@@ -51,19 +58,8 @@ function formatSenderLabel(label: string | null | undefined, address: string): s
</script>
<template>
<div class="composer-sender px-4 pt-4 pb-0">
<v-text-field
v-if="options.length === 1"
:model-value="singleOptionLabel"
label="From"
variant="outlined"
density="compact"
readonly
class="mb-2"
/>
<div v-if="options.length !== 1" class="composer-sender px-4 pt-4 pb-0">
<v-select
v-else
:model-value="selectedValue"
:items="items"
item-title="title"
+3 -2
View File
@@ -40,10 +40,11 @@ const handleAccountSaved = async () => {
<v-list-item
v-for="service in servicesStore.services"
:key="`${service.provider}:${service.identifier}`"
:class="{ 'opacity-60': !service.enabled }"
>
<template #prepend>
<v-avatar color="primary">
<v-icon>mdi-email</v-icon>
<v-avatar :color="service.enabled ? 'primary' : 'grey'">
<v-icon>{{ service.enabled ? 'mdi-email' : 'mdi-email-off' }}</v-icon>
</v-avatar>
</template>