Skip to content

Commit 15dee0b

Browse files
committed
Make changes requested in the review
1 parent d03f90d commit 15dee0b

File tree

12 files changed

+77
-88
lines changed

12 files changed

+77
-88
lines changed

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/FormInteractionManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import net.dv8tion.jda.api.entities.Message;
2727
import net.dv8tion.jda.api.entities.MessageEmbed;
2828
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
29+
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
2930
import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent;
3031
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
3132
import net.dv8tion.jda.api.events.interaction.component.ButtonInteractionEvent;
@@ -80,7 +81,7 @@ public void closeForm(Guild guild, FormData form) {
8081
form.getAttachmentInfo().ifPresent(info -> {
8182
long messageChannelId = info.messageChannelId();
8283
long messageId = info.messageId();
83-
TextChannel formChannel = guild.getTextChannelById(messageChannelId);
84+
MessageChannel formChannel = guild.getJDA().getChannelById(MessageChannel.class, messageChannelId);
8485
formChannel.retrieveMessageById(messageId).queue(msg -> {
8586
mapFormMessageButtons(msg, btn -> {
8687
String cptId = btn.getCustomId();

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/AddFieldFormSubcommand.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@
88
import net.discordjug.javabot.systems.staff_commands.forms.model.FormData;
99
import net.discordjug.javabot.systems.staff_commands.forms.model.FormField;
1010
import net.dv8tion.jda.api.components.textinput.TextInputStyle;
11+
import net.dv8tion.jda.api.entities.Message;
1112
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
1213
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
1314
import net.dv8tion.jda.api.interactions.AutoCompleteQuery;
1415
import net.dv8tion.jda.api.interactions.commands.Command.Choice;
1516
import net.dv8tion.jda.api.interactions.commands.OptionMapping;
1617
import net.dv8tion.jda.api.interactions.commands.OptionType;
18+
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
1719
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
1820
import xyz.dynxsty.dih4jda.interactions.AutoCompletable;
19-
import xyz.dynxsty.dih4jda.util.AutoCompleteUtils;
2021

2122
/**
2223
* The `/form add-field` command. This command allows for modification of
@@ -56,7 +57,11 @@ public AddFieldFormSubcommand(FormsRepository formsRepo, BotConfig botConfig) {
5657
.addOption(OptionType.STRING, FORM_PLACEHOLDER_FIELD, "Field placeholder")
5758
.addOption(OptionType.BOOLEAN, FORM_REQUIRED_FIELD,
5859
"Whether or not the user has to input data in this field. Default: false")
59-
.addOption(OptionType.STRING, FORM_STYLE_FIELD, "Input style. Default: SHORT", false, true)
60+
.addOptions(
61+
new OptionData(OptionType.STRING, FORM_STYLE_FIELD, "Input style. Default: SHORT", false)
62+
.addChoices(
63+
Arrays.stream(TextInputStyle.values()).filter(t -> t != TextInputStyle.UNKNOWN)
64+
.map(style -> new Choice(style.name(), style.name())).toList()))
6065
.addOption(OptionType.STRING, FORM_VALUE_FIELD, "Initial field value"));
6166
}
6267

@@ -71,7 +76,7 @@ public void execute(SlashCommandInteractionEvent event) {
7176
}
7277
FormData form = formOpt.get();
7378

74-
if (form.fields().size() >= 5) {
79+
if (form.fields().size() >= Message.MAX_COMPONENT_COUNT) {
7580
event.getHook().sendMessage("Can't add more than 5 components to a form").queue();
7681
return;
7782
}
@@ -82,12 +87,7 @@ public void execute(SlashCommandInteractionEvent event) {
8287

8388
@Override
8489
public void handleAutoComplete(CommandAutoCompleteInteractionEvent event, AutoCompleteQuery target) {
85-
if (!handleFormIDAutocomplete(event, target) && FORM_STYLE_FIELD.equals(target.getName())) {
86-
event.replyChoices(AutoCompleteUtils.filterChoices(event,
87-
Arrays.stream(TextInputStyle.values()).filter(t -> t != TextInputStyle.UNKNOWN)
88-
.map(style -> new Choice(style.name(), style.name())).toList()))
89-
.queue();
90-
}
90+
handleFormIDAutocomplete(event, target);
9191
}
9292

9393
private static FormField createFormFieldFromEvent(SlashCommandInteractionEvent e) {

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/AttachFormSubcommand.java

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package net.discordjug.javabot.systems.staff_commands.forms.commands;
22

33
import java.util.ArrayList;
4-
import java.util.Collections;
54
import java.util.List;
65
import java.util.Optional;
76
import java.util.Set;
@@ -27,12 +26,11 @@
2726
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
2827
import net.dv8tion.jda.api.interactions.commands.build.SubcommandData;
2928
import xyz.dynxsty.dih4jda.interactions.AutoCompletable;
30-
import xyz.dynxsty.dih4jda.util.AutoCompleteUtils;
3129
import xyz.dynxsty.dih4jda.util.ComponentIdBuilder;
3230

3331
/**
3432
* The `/form attach` command. This command can be used to attach a form to an
35-
* existing message. "Attaching" a form to message in this case mean that the
33+
* existing message. "Attaching" a form to message in this case means that the
3634
* bot will modify the target message with a button, that when interacted with,
3735
* will bring up a modal where the user can input their data. See
3836
* {@link DetachFormSubcommand} for a command used to detach the form from a
@@ -64,7 +62,10 @@ public AttachFormSubcommand(FormsRepository formsRepo, BotConfig botConfig) {
6462
new OptionData(OptionType.STRING, FORM_BUTTON_LABEL_FIELD,
6563
"Label of the submit button. Default is \"Submit\""),
6664
new OptionData(OptionType.STRING, FORM_BUTTON_STYLE_FIELD, "Submit button style. Defaults to primary",
67-
false, true)));
65+
false)
66+
.addChoices(Set
67+
.of(ButtonStyle.DANGER, ButtonStyle.PRIMARY, ButtonStyle.SECONDARY, ButtonStyle.SUCCESS)
68+
.stream().map(style -> new Choice(style.name(), style.name())).toList())));
6869
}
6970

7071
@Override
@@ -106,14 +107,13 @@ public void execute(SlashCommandInteractionEvent event) {
106107
}
107108

108109
String buttonLabel = event.getOption(FORM_BUTTON_LABEL_FIELD, "Submit", OptionMapping::getAsString);
109-
net.dv8tion.jda.api.components.buttons.ButtonStyle style = event.getOption(FORM_BUTTON_STYLE_FIELD,
110-
ButtonStyle.PRIMARY, t -> {
111-
try {
112-
return ButtonStyle.valueOf(t.getAsString().toUpperCase());
113-
} catch (IllegalArgumentException e) {
114-
return ButtonStyle.PRIMARY;
115-
}
116-
});
110+
ButtonStyle style = event.getOption(FORM_BUTTON_STYLE_FIELD, ButtonStyle.PRIMARY, t -> {
111+
try {
112+
return ButtonStyle.valueOf(t.getAsString().toUpperCase());
113+
} catch (IllegalArgumentException e) {
114+
return ButtonStyle.PRIMARY;
115+
}
116+
});
117117

118118
msgChannel.retrieveMessageById(messageId).queue(message -> {
119119
attachFormToMessage(message, buttonLabel, style, form);
@@ -126,12 +126,7 @@ public void execute(SlashCommandInteractionEvent event) {
126126

127127
@Override
128128
public void handleAutoComplete(CommandAutoCompleteInteractionEvent event, AutoCompleteQuery target) {
129-
if (!handleFormIDAutocomplete(event, target) && FORM_BUTTON_STYLE_FIELD.equals(target.getName())) {
130-
event.replyChoices(AutoCompleteUtils.filterChoices(event,
131-
Set.of(ButtonStyle.DANGER, ButtonStyle.PRIMARY, ButtonStyle.SECONDARY, ButtonStyle.SUCCESS).stream()
132-
.map(style -> new Choice(style.name(), style.name())).toList()))
133-
.queue();
134-
}
129+
handleFormIDAutocomplete(event, target);
135130
}
136131

137132
private static void attachFormToMessage(Message message, String buttonLabel, ButtonStyle style, FormData form) {
@@ -149,9 +144,8 @@ private static void attachFormToMessage(Message message, String buttonLabel, But
149144
rows.add(ActionRow.of(button));
150145
} else {
151146
ActionRow lastRow = rows.get(rows.size() - 1);
152-
List<ActionRowChildComponent> components = new ArrayList<>(lastRow.getComponents().size() + 1);
153-
Collections.copy(components, lastRow.getComponents());
154-
components.set(components.size() - 1, button);
147+
List<ActionRowChildComponent> components = new ArrayList<>(lastRow.getComponents());
148+
components.add(button);
155149
rows.set(rows.size() - 1, ActionRow.of(components));
156150
}
157151

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/DeleteFormSubcommand.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,8 @@
1515
import xyz.dynxsty.dih4jda.interactions.AutoCompletable;
1616

1717
/**
18-
* The `/form delete` command. Deletes an existing form. This command does NOT
19-
* delete submission records from the database, see
20-
* {@link SubmissionsDeleteFormSubcommand}. This command won't work if the form
18+
* The `/form delete` command. Deletes an existing form. This command also does
19+
* delete submission records from the database. This command won't work if the form
2120
* is attached to a message, see {@link DetachFormSubcommand}
2221
*
2322
* @see FormData

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/DetachFormSubcommand.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import net.dv8tion.jda.api.components.actionrow.ActionRowChildComponentUnion;
1414
import net.dv8tion.jda.api.components.buttons.Button;
1515
import net.dv8tion.jda.api.entities.Guild;
16-
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
16+
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
1717
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
1818
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
1919
import net.dv8tion.jda.api.interactions.AutoCompleteQuery;
@@ -89,7 +89,7 @@ public static void detachFromMessage(FormData form, Guild guild) {
8989
form.getAttachmentInfo().ifPresent(info -> {
9090
long messageChannelId = info.messageChannelId();
9191
long messageId = info.messageId();
92-
TextChannel formChannel = guild.getTextChannelById(messageChannelId);
92+
MessageChannel formChannel = guild.getJDA().getChannelById(MessageChannel.class, messageChannelId);
9393
if (formChannel != null) {
9494
formChannel.retrieveMessageById(messageId).queue(msg -> {
9595
List<ActionRow> components = msg.getComponents().stream().map(msgComponent -> {

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/DetailsFormSubcommand.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
import net.discordjug.javabot.systems.staff_commands.forms.model.FormData;
99
import net.dv8tion.jda.api.EmbedBuilder;
1010
import net.dv8tion.jda.api.entities.Guild;
11-
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
11+
import net.dv8tion.jda.api.entities.Message;
12+
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
1213
import net.dv8tion.jda.api.events.interaction.command.CommandAutoCompleteInteractionEvent;
1314
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
1415
import net.dv8tion.jda.api.interactions.AutoCompleteQuery;
@@ -87,23 +88,23 @@ private EmbedBuilder createFormDetailsEmbed(FormData form, Guild guild) {
8788

8889
channelMention = attachmentInfoOptonal.map(info -> {
8990
long channelId = info.messageChannelId();
90-
TextChannel channel = guild.getTextChannelById(channelId);
91+
MessageChannel channel = guild.getJDA().getChannelById(MessageChannel.class, channelId);
9192
return channel != null ? channel.getAsMention() : "`" + channelId + "`";
9293
}).orElse("*Not attached*");
9394

9495
messageLink = attachmentInfoOptonal.map(attachmentInfo -> {
9596
long messageId = attachmentInfo.messageId();
9697
long channelId = attachmentInfo.messageChannelId();
9798
return MarkdownUtil.maskedLink("Link",
98-
String.format("https://discord.com/channels/%s/%s/%s", guild.getId(), channelId, messageId));
99+
String.format(Message.JUMP_URL, guild.getId(), channelId, messageId));
99100
}).orElse("*Not attached*");
100101

101102
String submissionsChannelMention;
102-
TextChannel submissionsChannel = guild.getTextChannelById(form.submitChannel());
103+
MessageChannel submissionsChannel = guild.getJDA().getChannelById(MessageChannel.class, form.submitChannel());
103104
if (submissionsChannel != null) {
104105
submissionsChannelMention = submissionsChannel.getAsMention();
105106
} else {
106-
submissionsChannelMention = "`" + form.submitChannel();
107+
submissionsChannelMention = "`" + form.submitChannel() + "`";
107108
}
108109

109110
builder.addField("Attached in", channelMention, true);

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/FormCommand.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package net.discordjug.javabot.systems.staff_commands.forms.commands;
22

3+
import net.dv8tion.jda.api.Permission;
34
import net.dv8tion.jda.api.interactions.InteractionContextType;
45
import net.dv8tion.jda.api.interactions.commands.DefaultMemberPermissions;
56
import net.dv8tion.jda.api.interactions.commands.build.Commands;
@@ -34,8 +35,9 @@ public FormCommand(CreateFormSubcommand createSub, DeleteFormSubcommand deleteSu
3435
AddFieldFormSubcommand addFieldSub, RemoveFieldFormSubcommand removeFieldSub, ShowFormSubcommand showSub,
3536
AttachFormSubcommand attachSub, DetachFormSubcommand detachSub,
3637
SubmissionsExportFormSubcommand submissionsGetSub, SubmissionsDeleteFormSubcommand submissionsDeleteSub) {
37-
setCommandData(Commands.slash("form", "Commands for managing modal forms")
38-
.setContexts(InteractionContextType.GUILD).setDefaultPermissions(DefaultMemberPermissions.DISABLED));
38+
setCommandData(
39+
Commands.slash("form", "Commands for managing modal forms").setContexts(InteractionContextType.GUILD)
40+
.setDefaultPermissions(DefaultMemberPermissions.enabledFor(Permission.MANAGE_SERVER)));
3941
addSubcommands(createSub, deleteSub, closeSub, reopenSub, detailsSub, modifySub, addFieldSub, removeFieldSub,
4042
showSub, attachSub, detachSub, submissionsGetSub, submissionsDeleteSub);
4143
}

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/FormSubcommand.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import net.dv8tion.jda.api.interactions.callbacks.IReplyCallback;
1010
import net.dv8tion.jda.api.interactions.commands.Command.Choice;
1111
import xyz.dynxsty.dih4jda.interactions.commands.application.SlashCommand.Subcommand;
12+
import xyz.dynxsty.dih4jda.util.AutoCompleteUtils;
1213

1314
/**
1415
* Base abstract class containing common methods used in form subcommands.
@@ -19,37 +20,37 @@ public abstract class FormSubcommand extends Subcommand {
1920
* Form ID field identificator used in form subcommands.
2021
*/
2122
protected static final String FORM_ID_FIELD = "form-id";
22-
23+
2324
/**
2425
* Channel field identifier.
2526
*/
2627
protected static final String FORM_CHANNEL_FIELD = "channel";
27-
28+
2829
/**
2930
* Message id field identifier.
3031
*/
3132
protected static final String FORM_MESSAGE_ID_FIELD = "message-id";
32-
33+
3334
/**
3435
* Expiration field identifier.
3536
*/
3637
protected static final String FORM_EXPIRATION_FIELD = "expiration";
37-
38+
3839
/**
3940
* "onetime" field identifier.
4041
*/
4142
protected static final String FORM_ONETIME_FIELD = "onetime";
42-
43+
4344
/**
4445
* Submit message field identifier.
4546
*/
4647
protected static final String FORM_SUBMIT_MESSAGE_FIELD = "submit-message";
47-
48+
4849
/**
4950
* Submit channel field identifier.
5051
*/
5152
protected static final String FORM_SUBMIT_CHANNEL_FIELD = "submit-channel";
52-
53+
5354
/**
5455
* Form title field identifier.
5556
*/
@@ -60,7 +61,7 @@ public abstract class FormSubcommand extends Subcommand {
6061
/**
6162
* The main constructor.
6263
*
63-
* @param botConfig main bot configuration
64+
* @param botConfig main bot configuration
6465
* @param formsRepository the forms repository
6566
*/
6667
public FormSubcommand(BotConfig botConfig, FormsRepository formsRepository) {
@@ -94,9 +95,8 @@ protected boolean checkForStaffRole(IReplyCallback event) {
9495
*/
9596
protected boolean handleFormIDAutocomplete(CommandAutoCompleteInteractionEvent event, AutoCompleteQuery target) {
9697
if (FORM_ID_FIELD.equals(target.getName())) {
97-
event.replyChoices(
98-
formsRepository.getAllForms().stream().map(form -> new Choice(form.toString(), form.id())).toList())
99-
.queue();
98+
event.replyChoices(AutoCompleteUtils.filterChoices(event, formsRepository.getAllForms().stream()
99+
.map(form -> new Choice(form.toString(), form.id())).toList())).queue();
100100
return true;
101101
}
102102
return false;

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/commands/ModifyFormSubcommand.java

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,19 @@ public class ModifyFormSubcommand extends FormSubcommand implements AutoCompleta
3737
public ModifyFormSubcommand(FormsRepository formsRepo, BotConfig botConfig) {
3838
super(botConfig, formsRepo);
3939
this.formsRepo = formsRepo;
40-
setCommandData(new SubcommandData("modify", "Modify an existing form's data. Use *-field commands to manage form fields").addOptions(
41-
new OptionData(OptionType.INTEGER, FORM_ID_FIELD, "ID of the form to modify", true, true),
42-
new OptionData(OptionType.STRING, FORM_TITLE_FIELD, "Form title (shown in modal)"),
43-
new OptionData(OptionType.CHANNEL, FORM_SUBMIT_CHANNEL_FIELD, "Channel to log form submissions in"),
44-
new OptionData(OptionType.STRING, FORM_SUBMIT_MESSAGE_FIELD,
45-
"Message displayed to the user once they submit the form"),
46-
new OptionData(OptionType.STRING, FORM_EXPIRATION_FIELD,
47-
"UTC time after which the form stops accepting submissions. - for no expiration. "
48-
+ FormInteractionManager.DATE_FORMAT_STRING),
49-
new OptionData(OptionType.BOOLEAN, FORM_ONETIME_FIELD,
50-
"If the form should only accept one submission per user. Defaults to false.")));
40+
setCommandData(new SubcommandData("modify",
41+
"Modify an existing form's data. Use *-field commands to manage form fields")
42+
.addOptions(new OptionData(OptionType.INTEGER, FORM_ID_FIELD, "ID of the form to modify", true, true),
43+
new OptionData(OptionType.STRING, FORM_TITLE_FIELD, "Form title (shown in modal)"),
44+
new OptionData(OptionType.CHANNEL, FORM_SUBMIT_CHANNEL_FIELD,
45+
"Channel to log form submissions in"),
46+
new OptionData(OptionType.STRING, FORM_SUBMIT_MESSAGE_FIELD,
47+
"Message displayed to the user once they submit the form"),
48+
new OptionData(OptionType.STRING, FORM_EXPIRATION_FIELD,
49+
"UTC time after which the form stops accepting submissions. - for no expiration. "
50+
+ FormInteractionManager.DATE_FORMAT_STRING),
51+
new OptionData(OptionType.BOOLEAN, FORM_ONETIME_FIELD,
52+
"If the form should only accept one submission per user. Defaults to false.")));
5153
}
5254

5355
@Override
@@ -61,14 +63,16 @@ public void execute(SlashCommandInteractionEvent event) {
6163
}
6264
FormData oldForm = formOpt.get();
6365

64-
String title = event.getOption("title", oldForm.title(), OptionMapping::getAsString);
65-
long submitChannel = event.getOption("submit-channel", oldForm.submitChannel(), OptionMapping::getAsLong);
66-
String submitMessage = event.getOption("submit-message", oldForm.submitMessage(), OptionMapping::getAsString);
66+
String title = event.getOption(FORM_TITLE_FIELD, oldForm.title(), OptionMapping::getAsString);
67+
long submitChannel = event.getOption(FORM_SUBMIT_CHANNEL_FIELD, oldForm.submitChannel(),
68+
OptionMapping::getAsLong);
69+
String submitMessage = event.getOption(FORM_SUBMIT_MESSAGE_FIELD, oldForm.submitMessage(),
70+
OptionMapping::getAsString);
6771
Instant expiration;
68-
if (event.getOption("expiration") == null) {
72+
if (event.getOption(FORM_EXPIRATION_FIELD) == null) {
6973
expiration = oldForm.expiration();
7074
} else {
71-
if ("-".equals(event.getOption("expiration", OptionMapping::getAsString))) {
75+
if ("-".equals(event.getOption(FORM_EXPIRATION_FIELD, OptionMapping::getAsString))) {
7276
expiration = null;
7377
} else {
7478
Optional<Instant> expirationOpt;
@@ -82,7 +86,7 @@ public void execute(SlashCommandInteractionEvent event) {
8286
}
8387
}
8488

85-
boolean onetime = event.getOption("onetime", oldForm.onetime(), OptionMapping::getAsBoolean);
89+
boolean onetime = event.getOption(FORM_ONETIME_FIELD, oldForm.onetime(), OptionMapping::getAsBoolean);
8690

8791
Long messageId;
8892
Long messageChannel;

src/main/java/net/discordjug/javabot/systems/staff_commands/forms/dao/FormsRepository.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ public void addSubmission(User user, FormData form, Message message) {
240240
}
241241

242242
/**
243-
* Remove a field from a form. Fails silently if the index is out of bounds.
243+
* Remove a field from a form. Fails and return false if the index is out of
244+
* bounds.
244245
*
245246
* @param form form to remove the field from
246247
* @param index index of the field to remove
@@ -249,7 +250,8 @@ public void addSubmission(User user, FormData form, Message message) {
249250
public boolean removeField(FormData form, int index) {
250251
List<FormField> fields = form.fields();
251252
if (index < 0 || index >= fields.size()) return false;
252-
return jdbcTemplate.update("delete from `form_fields` where `id` = ?", fields.get(index).id()) > 0;
253+
return jdbcTemplate.update("delete from `form_fields` where `id` = ? and `form_id` = ?", fields.get(index).id(),
254+
form.id()) > 0;
253255
}
254256

255257
/**

0 commit comments

Comments
 (0)