diff --git a/config/vanilla/bootstrap.before.php b/config/vanilla/bootstrap.before.php index cf6eba1..3f617fe 100644 --- a/config/vanilla/bootstrap.before.php +++ b/config/vanilla/bootstrap.before.php @@ -339,7 +339,6 @@ function watchIcon($hasWatched = false, $title='') { if($hasWatched) { $icon = << - $title @@ -350,7 +349,6 @@ function watchIcon($hasWatched = false, $title='') { } else { $icon = << - $title @@ -388,18 +386,17 @@ function watchButton($category, $isHijackButton = true) { $categoryID= val('CategoryID', $category); $hasWatched = $categoryModel->hasWatched($categoryID, $userID); - $text = $hasWatched ? t('Stop watching the category') : t('Watch the category'); - $icon = watchIcon($hasWatched, $text); - $cssClasses = 'watchButton' . ($hasWatched ? ' isWatching': ''); + $text = $hasWatched ? t('Stop watching forum') : t('Watch forum'); + $icon = ''.$text.''. watchIcon($hasWatched); + $cssClasses = 'watchButton ' . ($hasWatched ? ' isWatching tooltip': 'tooltip'); if($isHijackButton) { $cssClasses = 'Hijack '.$cssClasses; } - $output .= anchor( - $icon, + $output .= anchor($icon, $hasWatched ? "/category/watched/{$categoryID}/" . Gdn::session()->transientKey() : "/category/watch/{$categoryID}/" . Gdn::session()->transientKey(), $cssClasses, - ['title' => $text, 'aria-pressed' => $hasWatched ? 'true' : 'false', 'role' => 'button', 'tabindex' => '0'] + [ 'aria-pressed' => $hasWatched ? 'true' : 'false', 'role' => 'button', 'tabindex' => '0'] ); } return $output; diff --git a/vanilla/applications/vanilla/views/discussion/helper_functions.php b/vanilla/applications/vanilla/views/discussion/helper_functions.php index bd45793..05e19e8 100644 --- a/vanilla/applications/vanilla/views/discussion/helper_functions.php +++ b/vanilla/applications/vanilla/views/discussion/helper_functions.php @@ -375,6 +375,8 @@ function getDiscussionOptionsDropdown($discussion = null) { // Permissions $canEdit = DiscussionModel::canEdit($discussion, $timeLeft); $canAnnounce = CategoryModel::checkPermission($categoryID, 'Vanilla.Discussions.Announce'); + // FIX: https://github.com/topcoder-platform/forums/issues/456 + $newAnnounceValue = $discussion->Announce > 0? 0 : 1; $canSink = CategoryModel::checkPermission($categoryID, 'Vanilla.Discussions.Sink'); $canClose = CategoryModel::checkPermission($categoryID, 'Vanilla.Discussions.Close'); $canDelete = CategoryModel::checkPermission($categoryID, 'Vanilla.Discussions.Delete'); @@ -392,7 +394,7 @@ function getDiscussionOptionsDropdown($discussion = null) { $dropdown->addLinkIf($canDismiss, t('Dismiss'), "vanilla/discussion/dismissannouncement?discussionid={$discussionID}", 'dismiss', 'DismissAnnouncement Hijack') ->addLinkIf($canEdit, t('Edit').$timeLeft, '/post/editdiscussion/'.$discussionID, 'edit') - ->addLinkIf($canAnnounce, t('Announce'), '/discussion/announce?discussionid='.$discussionID, 'announce', 'AnnounceDiscussion Popup') + ->addLinkIf($canAnnounce, $discussion->Announce > 0 ? t('Don\'t Announce'):t('Announce'), '/discussion/announce?discussionid='.$discussionID.'&announce='.$newAnnounceValue, 'announce', 'AnnounceDiscussion Hijack') ->addLinkIf($canSink, t($discussion->Sink ? 'Unsink' : 'Sink'), '/discussion/sink?discussionid='.$discussionID.'&sink='.(int)!$discussion->Sink, 'sink', 'SinkDiscussion Hijack') ->addLinkIf($canClose, t($discussion->Closed ? 'Reopen' : 'Close'), '/discussion/close?discussionid='.$discussionID.'&close='.(int)!$discussion->Closed, 'close', 'CloseDiscussion Hijack') ->addLinkIf($canRefetch, t('Refetch Page'), '/discussion/refetchpageinfo.json?discussionid='.$discussionID, 'refetch', 'RefetchPage Hijack') diff --git a/vanilla/applications/vanilla/views/discussions/helper_functions.php b/vanilla/applications/vanilla/views/discussions/helper_functions.php index f0680f5..435346a 100644 --- a/vanilla/applications/vanilla/views/discussions/helper_functions.php +++ b/vanilla/applications/vanilla/views/discussions/helper_functions.php @@ -81,13 +81,13 @@ function bookmarkButton($discussion) { // New value should be opposite $hasWatched = $discussion->Bookmarked == 1; $newValue = $hasWatched ? 0 : 1; - $title = t($hasWatched ? 'Stop watching the discussion' : 'Watch the discussion'); - $icon = watchIcon($hasWatched, $title); + $title = t($hasWatched ? 'Stop watching forum' : 'Watch forum'); + $icon = ''.$title.''.watchIcon($hasWatched); return anchor( $icon, '/discussion/bookmark/' . $discussion->DiscussionID . '/?tkey=' . Gdn::session()->transientKey() . '&bookmarked=' . $newValue, - 'Hijack watchButton ' . ($hasWatched ? ' isWatching' : ''), - ['title' => $title] + 'Hijack watchButton ' . ($hasWatched ? ' isWatching tooltip' : 'tooltip'), + [] ); } else { $notificationPreferences = $categoryModel->getCategoryNotificationPreferences($discussion->CategoryID, Gdn::session()->UserID); @@ -122,13 +122,13 @@ function bookmarkButton($discussion) { } } - $title = t($hasWatched ? 'Stop watching the discussion' : 'Watch the discussion'); - $icon = watchIcon($hasWatched, $title); + $title = t($hasWatched ? 'Stop watching forum' : 'Watch forum'); + $icon = ''.$title.''.watchIcon($hasWatched, ''); return anchor( $icon, '/discussion/bookmark/' . $discussion->DiscussionID . '/?tkey=' . Gdn::session()->transientKey() . '&bookmarked=' . $newValue, - 'Hijack watchButton ' . ($hasWatched ? ' isWatching' : ''), - ['title' => $title] + 'Hijack watchButton ' . ($hasWatched ? ' isWatching tooltip' : 'tooltip'), + [] ); } }