 talkConfig = require './config'
 SignInPrompt = require '../partials/sign-in-prompt'
 alert = require '../lib/alert'
+merge = require 'lodash.merge'
 
 PAGE_SIZE = talkConfig.discussionPageSize
 

                <label className="toggle">Locked:
                  <input name="locked" type="checkbox" defaultChecked={discussion?.locked}/>
                </label>
                <button type="submit">Update</button>
              </form>}


  onEditSubmit: (e) ->
    e.preventDefault()
    form = document.querySelector('.talk-edit-discussion-form')
    boardSelect = form.querySelector('select')

    title = form.querySelector('[name="title"]').value
    sticky = form.querySelector('[name="sticky"]').checked
    locked = form.querySelector('[name="locked"]').checked
    board_id = boardSelect.options[boardSelect.selectedIndex].value

    @discussionsRequest().update({title, sticky, locked, board_id}).save()
      .then (discussion) =>
        {owner, name} = @props.params
        discussionRoute = if (owner and name) then 'project-talk-discussion' else 'talk-discussion'
        @transitionTo discussionRoute, merge(@props.params, board: board_id), @props.query

  lockedMessage: ->
    <div className="talk-discussion-locked">
