Arc Forumnew | comments | leaders | submitlogin
Submit url + comment when both fields exist
2 points by printf 3489 days ago | 3 comments
Playing around with news.arc, I thought one interesting feature would be to post the "text" field in /submit as a comment if the user inputs "url". I'm assuming this logic goes in the process-story method.

    (def process-story (user url title showtext text ip)
         ....
               (let site (sitename url)
               (let s (create-story url (process-title title) text user ip)
                  ....
                 (submit-item user s)
                  ....
                 "newest"))))

Am I looking at the right place?

A) How do I add a call to submit comment? OR B) am I just looking at first submitting the post and then using that as a parent id and then submit the comment as a reply to that in a two-step process.

Thanks in advance.



2 points by akkartik 3489 days ago | link

I think A should be doable. Just call process-comment after submit-item? You'd be double-counting some stats, like for the oversubmitting check. But we can worry about that later.

-----

2 points by printf 3489 days ago | link

What would I pass as the arg for parent and whence?

-----

1 point by akkartik 3489 days ago | link

The parent would be the story you just created. whence is a url to go to on error. For starters it can probably be nil.

-----