Fix private lists being unsubscribed from public form and re-factor subscription status view in admin.

This commit is contained in:
Kailash Nadh 2023-08-06 21:09:16 +05:30
parent eafae46409
commit 1164afac5e
3 changed files with 24 additions and 9 deletions

View file

@ -302,18 +302,22 @@ func handleSubscriptionPrefs(c echo.Context) error {
// Get the subscriber's lists and whatever is not sent in the request (unchecked),
// unsubscribe them.
subs, err := app.core.GetSubscriptions(0, subUUID, false)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("public.errorFetchingLists"))
}
reqUUIDs := make(map[string]struct{})
for _, u := range req.ListUUIDs {
reqUUIDs[u] = struct{}{}
}
subs, err := app.core.GetSubscriptions(0, subUUID, false)
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, app.i18n.T("public.errorFetchingLists"))
}
unsubUUIDs := make([]string, 0, len(req.ListUUIDs))
for _, s := range subs {
if _, ok := reqUUIDs[s.UUID]; ok {
if s.Type == models.ListTypePrivate {
continue
}
if _, ok := reqUUIDs[s.UUID]; !ok {
unsubUUIDs = append(unsubUUIDs, s.UUID)
}
}

View file

@ -560,14 +560,14 @@ body.is-noscroll {
border: 1px solid lighten($color, 42%);
box-shadow: 1px 1px 0 lighten($color, 42%);
}
&.finished, &.enabled {
&.finished, &.enabled, &.status-confirmed {
$color: $green;
color: $color;
background: #f6ffed;
border: 1px solid lighten($color, 45%);
box-shadow: 1px 1px 0 lighten($color, 45%);
}
&.blocklisted, &.cancelled {
&.blocklisted, &.cancelled, &.status-unsubscribed {
$color: $red;
color: $color;
background: #fff1f0;
@ -591,6 +591,7 @@ body.is-noscroll {
}
}
/* Page header */
.page-header {
.buttons {
@ -675,6 +676,10 @@ section.lists {
thead th, tbody td {
padding: 10px;
}
td.status .tag {
width: 100%;
}
}
.bounces {

View file

@ -94,17 +94,23 @@
</b-tag>{{ ' ' }}
</div>
</b-table-column>
<b-table-column v-slot="props" field="status" :label="$t('globals.fields.status')">
{{ props.row.optin === 'double' ? props.row.subscriptionStatus : '-' }}
<b-table-column v-slot="props" field="status" cell-class="status"
:label="$t('globals.fields.status')">
<b-tag :class="`status-${props.row.subscriptionStatus}`">
{{ $t(`subscribers.status.${props.row.subscriptionStatus}`) }}
</b-tag>
<template v-if="props.row.optin === 'double'
&& props.row.subscriptionMeta.optinIp">
<br /><span class="is-size-7">{{ props.row.subscriptionMeta.optinIp }}</span>
</template>
</b-table-column>
<b-table-column v-slot="props" field="createdAt"
:label="$t('globals.fields.createdAt')">
{{ $utils.niceDate(props.row.subscriptionCreatedAt, true) }}
</b-table-column>
<b-table-column v-slot="props" field="updatedAt"
:label="$t('globals.fields.updatedAt')">
{{ $utils.niceDate(props.row.subscriptionCreatedAt, true) }}