Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#727 Sender email se večkrat pošlje #143

Merged
merged 6 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def client_send(self, sender: str, recipient: Recipient, msg: dict, dlr_id: str)
.client("ses")
.send_email(
Destination={
"ToAddresses": [sender],
"ToAddresses": [recipient.email],
"CcAddresses": [],
"BccAddresses": [recipient.email],
"BccAddresses": [],
},
Message=msg,
Source=sender,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import uuid
from typing import List

from django.conf import settings
Expand All @@ -24,6 +25,14 @@ def send(self, notification: DjangoProjectBaseNotification, extra_data, **kwargs
list(map(int, notification.recipients.split(","))) if notification.recipients else []
)
return len(recipients)
message = self.provider.get_message(notification)
sender = self.sender(notification)
self.provider.client_send(
self.sender(notification),
Recipient(identifier=str(uuid.uuid4()), phone_number="", email=sender),
message,
str(uuid.uuid4()),
)
return super().send(notification=notification, extra_data=extra_data)

def get_recipients(self, notification: DjangoProjectBaseNotification, unique_identifier=""):
Expand Down
6 changes: 3 additions & 3 deletions vue/components/notifications-editor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
APIConsumer,
ComponentDisplay,
ConsumerLogicApi,
FormConsumerOneShotApi, gettext,
FormConsumerApiOneShot, gettext,
useActionHandler,
} from '@velis/dynamicforms';
import { onMounted, onUnmounted, ref } from 'vue';
Expand Down Expand Up @@ -50,12 +50,12 @@ const notificationLogic = ref(new ConsumerLogicApi(
notificationLogic.value.getFullDefinition();

const actionViewLicense = async (): Promise<boolean> => {
await FormConsumerOneShotApi({ url: licenseConsumerUrl, trailingSlash: licenseConsumerUrlTrailingSlash, pk: 'new' });
await FormConsumerApiOneShotv({ url: licenseConsumerUrl, trailingSlash: licenseConsumerUrlTrailingSlash, pk: 'new' });
return true;
};

const actionAddNotification = async (): Promise<boolean> => {
await FormConsumerOneShotApi({
await FormConsumerApiOneShot({
url: consumerUrl,
trailingSlash: consumerTrailingSlash,
pk: 'new',
Expand Down
2 changes: 2 additions & 0 deletions vue/components/profile-search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ const inputProps = defineProps<{

const emit = defineEmits(['selected']);

// todo: https://taiga.velis.si/project/velis74-dynamic-forms/us/836?no-milestone=1

const searchUrl: string = (inputProps.searchUrl !== undefined ? inputProps.searchUrl : '/account/profile') as string;

const selected: Ref<UserDataJSON | null> = ref(null);
Expand Down
4 changes: 2 additions & 2 deletions vue/components/user-session/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
ConsumerLogicApi, dfModal as dfModalApi,
dfModal, DialogSize,
DisplayMode,
FilteredActions, FormConsumerOneShotApi,
FilteredActions, FormConsumerApiOneShot,
FormPayload,
gettext,
} from '@velis/dynamicforms';
Expand Down Expand Up @@ -221,7 +221,7 @@ export default function useLogin() {
socialAuth.value = formDef.payload.social_auth_providers;
}

const openRegistration = async () => FormConsumerOneShotApi(
const openRegistration = async () => FormConsumerApiOneShot(
{ url: '/account/profile/register', trailingSlash: false },
);

Expand Down
5 changes: 2 additions & 3 deletions vue/components/user-session/project-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
Action,
apiClient,
dfModal,
FormConsumerOneShotApi,
FormConsumerApiOneShot,
FormPayload,
} from '@velis/dynamicforms';
import slugify from 'slugify';
Expand Down Expand Up @@ -46,7 +46,6 @@ async function loadData() {
}

async function addNewProject() {
// const addProjectModal = await FormConsumerOneShotApi({ url: '/project', trailingSlash: false, pk: 'new' });
let slugChanged = false;
let ignoreSlugChange = false;
const valueChangedHandler = (action: Action, payload: FormPayload, context: any) => {
Expand All @@ -60,7 +59,7 @@ async function addNewProject() {
}
return false;
};
const addProjectModal = await FormConsumerOneShotApi(
const addProjectModal = await FormConsumerApiOneShot(
{
url: '/project',
trailingSlash: false,
Expand Down
8 changes: 4 additions & 4 deletions vue/components/user-session/user-profile.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { Action, dfModal, DialogSize, FilteredActions, FormConsumerOneShotApi, gettext } from '@velis/dynamicforms';
import { Action, dfModal, DialogSize, FilteredActions, FormConsumerApiOneShot, gettext } from '@velis/dynamicforms';
import axios from 'axios';
import _ from 'lodash';
import { computed, h, onMounted, watch } from 'vue';
Expand Down Expand Up @@ -30,7 +30,7 @@ let socialConnectionsModalPromise = null as any;
const showProjectList = computed(() => (props.projectListComponent && userSession.loggedIn && display.smAndDown.value));

async function changePassword() {
await FormConsumerOneShotApi({ url: '/account/change-password/', trailingSlash: true, pk: 'new' });
await FormConsumerApiOneShot({ url: '/account/change-password/', trailingSlash: true, pk: 'new' });
}

async function checkResetPassword() {
Expand All @@ -52,7 +52,7 @@ watch(() => userSession.impersonated, () => window.location.reload());
onMounted(() => loadData());

async function showImpersonateLogin() {
await FormConsumerOneShotApi({ url: '/account/impersonate', trailingSlash: false });
await FormConsumerApiOneShot({ url: '/account/impersonate', trailingSlash: false });
await userSession.checkLogin(false);
}

Expand All @@ -62,7 +62,7 @@ async function stopImpersonation() {
}

async function userProfile() {
await FormConsumerOneShotApi({ url: '/account/profile/current', trailingSlash: false });
await FormConsumerApiOneShot({ url: '/account/profile/current', trailingSlash: false });
await userSession.checkLogin(false);
}

Expand Down
1 change: 1 addition & 0 deletions vue/profile-search-add-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { UserDataJSON } from './components/user-session/data-types';

let selectedUser: UserDataJSON | undefined;

// todo: https://taiga.velis.si/project/velis74-dynamic-forms/us/836?no-milestone=1
function selected(profile: UserDataJSON) {
selectedUser = profile;
}
Expand Down
Loading