1
0
Fork 0
mirror of https://github.com/KingDuckZ/kamokan.git synced 2025-08-19 13:29:49 +00:00

Add a bool to mustache to tell if a pastie got self-destructed.

This commit is contained in:
King_DuckZ 2017-06-14 20:31:17 +01:00
parent b6edab7171
commit 218e9ab6cd
5 changed files with 21 additions and 14 deletions

View file

@ -62,7 +62,7 @@ namespace kamokan {
return submission_res;
}
boost::optional<std::string> FakeStorage::retrieve_pastie (const boost::string_view& parToken) const {
Storage::RetrievedPastie FakeStorage::retrieve_pastie (const boost::string_view& parToken) const {
auto it_found = std::find_if(
m_submitted_pasties.begin(),
m_submitted_pasties.end(),
@ -71,9 +71,9 @@ namespace kamokan {
}
);
if (m_submitted_pasties.end() == it_found)
return boost::optional<std::string>();
return RetrievedPastie {boost::optional<std::string>(), false};
else
return boost::make_optional(it_found->text);
return RetrievedPastie {boost::make_optional(it_found->text), it_found->self_destruct};
}
const std::vector<FakeStorage::SubmittedPastie>& FakeStorage::submitted_pasties() const {

View file

@ -52,7 +52,7 @@ namespace kamokan {
const std::string& parRemoteIP
) const override;
kamokan_virtual_testing boost::optional<std::string> retrieve_pastie (const boost::string_view& parToken) const override;
kamokan_virtual_testing Storage::RetrievedPastie retrieve_pastie (const boost::string_view& parToken) const override;
const std::vector<SubmittedPastie>& submitted_pasties() const;