Skip to content

Commit 0760355

Browse files
committed
composer: add custom_compose_hooks only once
Custom compose hooks are set in Composer::with_account(), yet we re-add them in other constructor methods as well after calling with_account(). Signed-off-by: Manos Pitsidianakis <[email protected]>
1 parent f5afcf7 commit 0760355

File tree

1 file changed

+0
-26
lines changed

1 file changed

+0
-26
lines changed

meli/src/mail/compose.rs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -295,19 +295,6 @@ impl Composer {
295295
context: &Context,
296296
) -> Result<Self> {
297297
let mut ret = Self::with_account(account_hash, context);
298-
// Add user's custom hooks.
299-
for hook in account_settings!(context[account_hash].composing.custom_compose_hooks)
300-
.iter()
301-
.cloned()
302-
.map(Into::into)
303-
{
304-
ret.hooks.push(hook);
305-
}
306-
ret.hooks.retain(|h| {
307-
!account_settings!(context[account_hash].composing.disabled_compose_hooks)
308-
.iter()
309-
.any(|hn| hn.as_str() == h.name())
310-
});
311298
let envelope: EnvelopeRef = context.accounts[&account_hash].collection.get_env(env_hash);
312299

313300
ret.draft = Draft::edit(&envelope, bytes, Text::Plain)?;
@@ -323,19 +310,6 @@ impl Composer {
323310
reply_to_all: bool,
324311
) -> Self {
325312
let mut ret = Self::with_account(account_hash, context);
326-
// Add user's custom hooks.
327-
for hook in account_settings!(context[account_hash].composing.custom_compose_hooks)
328-
.iter()
329-
.cloned()
330-
.map(Into::into)
331-
{
332-
ret.hooks.push(hook);
333-
}
334-
ret.hooks.retain(|h| {
335-
!account_settings!(context[account_hash].composing.disabled_compose_hooks)
336-
.iter()
337-
.any(|hn| hn.as_str() == h.name())
338-
});
339313
let account = &context.accounts[&account_hash];
340314
let envelope = account.collection.get_env(coordinates.2);
341315
let subject = {

0 commit comments

Comments
 (0)