fix initialisation of Bot members, 'published' was not copied up
This commit is contained in:
parent
95fed42020
commit
d64a9c75e8
4 changed files with 8 additions and 10 deletions
|
|
@ -41,14 +41,15 @@ public class Bot {
|
||||||
|
|
||||||
Bot() {
|
Bot() {
|
||||||
}
|
}
|
||||||
Bot( String username, String name, String summary, String type, boolean manuallyApproveFollowers, boolean indexable, String pubicKeyPem ) {
|
Bot( String username, String name, String summary, Instant published, String publicKeyPem, String type, boolean manuallyApproveFollowers, boolean indexable ) {
|
||||||
this.username = username;
|
this.username = username;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.summary = summary;
|
this.summary = summary;
|
||||||
|
this.published = published;
|
||||||
|
this.publicKeyPem = publicKeyPem;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.manuallyApproveFollowers = manuallyApproveFollowers;
|
this.manuallyApproveFollowers = manuallyApproveFollowers;
|
||||||
this.indexable = indexable;
|
this.indexable = indexable;
|
||||||
this.publicKeyPem = publicKeyPem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,9 @@ public class BotController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/makebot")
|
@PostMapping("/makebot")
|
||||||
public String makebotpost(@ModelAttribute("bot") Bot bot) {
|
public String makebotpost(Bot bot, Model model) {
|
||||||
//log.info(bot);
|
bot = botServ.save(bot);
|
||||||
|
model.addAttribute("bot", bot);
|
||||||
botServ.save(bot);
|
|
||||||
|
|
||||||
return "makebot_submitted";
|
return "makebot_submitted";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,7 @@ public class BotJpaRepo implements BotRepo {
|
||||||
BotModel botModel = BotModel.from(bot);
|
BotModel botModel = BotModel.from(bot);
|
||||||
BotModel saved = botJdbcRepo.save(botModel);
|
BotModel saved = botJdbcRepo.save(botModel);
|
||||||
return saved.asBot();
|
return saved.asBot();
|
||||||
// this pattern comes from the 'ensembler' MemberRepositoryJdbcAdapter impl
|
// returning the bot here means that automated fields like creation dates are bubbled up
|
||||||
// TODO: in our case I'm not sure we need to be returning a Bot, could be void?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<Bot> findByUsername(String username) {
|
public Optional<Bot> findByUsername(String username) {
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ public class BotModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
Bot asBot() {
|
Bot asBot() {
|
||||||
return new Bot( username, name, summary, type, manuallyApproveFollowers, indexable, publicKeyPem );
|
return new Bot( username, name, summary, published, publicKeyPem, type, manuallyApproveFollowers, indexable );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue