Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions config/vanilla/bootstrap.before.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ function watchIcon($hasWatched = false, $title='') {
if($hasWatched) {
$icon = <<<EOT
<svg width="21px" height="14px" viewBox="0 0 21 14" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>$title</title>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="02-Challenge-Forums" transform="translate(-1261.000000, -328.000000)" fill="#0AB88A" fill-rule="nonzero">
<path d="M1271.08333,328 C1266.5,328 1262.58583,330.850833 1261,334.875 C1262.58583,338.899167 1266.5,341.75 1271.08333,341.75 C1275.66667,341.75 1279.58083,338.899167 1281.16667,334.875 C1279.58083,330.850833 1275.66667,328 1271.08333,328 Z M1271.08333,339.458333 C1268.55333,339.458333 1266.5,337.405 1266.5,334.875 C1266.5,332.345 1268.55333,330.291667 1271.08333,330.291667 C1273.61333,330.291667 1275.66667,332.345 1275.66667,334.875 C1275.66667,337.405 1273.61333,339.458333 1271.08333,339.458333 Z M1271.08333,332.125 C1269.56167,332.125 1268.33333,333.353333 1268.33333,334.875 C1268.33333,336.396667 1269.56167,337.625 1271.08333,337.625 C1272.605,337.625 1273.83333,336.396667 1273.83333,334.875 C1273.83333,333.353333 1272.605,332.125 1271.08333,332.125 Z" id="Shape"></path>
Expand All @@ -350,7 +349,6 @@ function watchIcon($hasWatched = false, $title='') {
} else {
$icon = <<<EOT
<svg width="22px" height="22px" viewBox="0 0 22 22" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>$title</title>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="02-Challenge-Forums" transform="translate(-1260.000000, -594.000000)">
<g id="watch-icon" transform="translate(1260.000000, 594.000000)">
Expand Down Expand Up @@ -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 = '<span class="tooltiptext">'.$text.'</span>'. 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '<span class="tooltiptext">'.$title.'</span>'.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);
Expand Down Expand Up @@ -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 = '<span class="tooltiptext">'.$title.'</span>'.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'),
[]
);
}
}
Expand Down