Skip to content

Commit

Permalink
discussions: fix "close for comments" text on reopened topics
Browse files Browse the repository at this point in the history
fixes CNVS-12127

test plan:
  1. Log into a course as a teacher
  2. Create a discussion
  3. Navigate to the Discussion Index Page
  4. Close the discussion for comment
  5. Pin the discussion
  6. Open the cog menu and click on "Open for Comments"
  7. Open the cog menu again
  8. Verify that it gives you a "Close for Comments" option

Change-Id: I26036b0380beae75c79f893149099dfd572b71dd
Reviewed-on: https://gerrit.instructure.com/33048
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Clare Strong <clare@instructure.com>
  • Loading branch information
bluej100 authored and simonista committed Apr 9, 2014
1 parent 537638a commit 0ec866b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
11 changes: 3 additions & 8 deletions app/coffeescripts/views/DiscussionTopics/DiscussionView.coffee
Expand Up @@ -22,10 +22,6 @@ define [
messages:
confirm: I18n.t('confirm_delete_discussion_topic', 'Are you sure you want to delete this discussion topic?')
delete: I18n.t('delete', 'Delete')
lock: I18n.t('lock', 'Lock')
unlock: I18n.t('unlock', 'Unlock')
pin: I18n.t('pin', 'Pin')
unpin: I18n.t('unpin', 'Unpin')
user_subscribed: I18n.t('subscribed_hint', 'You are subscribed to this topic. Click to unsubscribe.')
user_unsubscribed: I18n.t('unsubscribed_hint', 'You are not subscribed to this topic. Click to subscribe.')

Expand All @@ -42,6 +38,7 @@ define [
els:
'.screenreader-only': '$title'
'.discussion-row': '$row'
'.discussion-actions .al-trigger': '$gearButton'

# Public: Topic is able to be locked/unlocked.
@optionProperty 'lockable'
Expand Down Expand Up @@ -71,11 +68,11 @@ define [
# Returns nothing.
toggleLocked: (e) =>
e.preventDefault()
key = if @model.get('locked') then 'lock' else 'unlock'
locked = !@model.get('locked')
pinned = if locked then false else @model.get('pinned')
@model.updateBucket(locked: locked, pinned: pinned)
$(e.target).text(@messages[key])
@render()
@$gearButton.focus()

# Public: Confirm a request to delete and then complete it if needed.
#
Expand All @@ -100,9 +97,7 @@ define [
# Returns nothing.
togglePinned: (e) =>
e.preventDefault()
key = if @model.get('pinned') then 'pin' else 'unpin'
@model.updateBucket(pinned: !@model.get('pinned'))
$(e.target).text(@messages[key])

# Public: Treat the whole <li /> as a link.
#
Expand Down
14 changes: 12 additions & 2 deletions spec/selenium/discussions_spec.rb
Expand Up @@ -388,7 +388,10 @@ def click_publish_icon(topic)
wait_for_ajaximations

f('.pinned.discussion-list .al-trigger').click
ffj('.icon-lock:visible').length.should == 1
fj('.icon-lock:visible').click
wait_for_ajaximations
f('.locked.discussion-list .al-trigger').click
fj('.icon-pin:visible').should include_text('Pin')
end

it "should allow pinning a locked topic" do
Expand All @@ -397,7 +400,14 @@ def click_publish_icon(topic)
wait_for_ajaximations

f('.locked.discussion-list .al-trigger').click
ffj('.icon-pin:visible').length.should == 1
fj('.icon-pin:visible').click
wait_for_ajaximations
f('.pinned.discussion-list .al-trigger').click
fj('.icon-lock:visible').should include_text('Open')
fj('.icon-lock:visible').click
wait_for_ajaximations
f('.pinned.discussion-list .al-trigger').click
fj('.icon-lock:visible').should include_text('Close')
end

it "should delete a topic" do
Expand Down

0 comments on commit 0ec866b

Please sign in to comment.