Skip to content

Commit 2b654ab

Browse files
authored
Merge pull request #504 from topcoder-platform/issues-498
Issues-498: fixed threaded/flat mode for anonymous; Issues-491: fixed quote functionality
2 parents a9cc020 + 1f1c812 commit 2b654ab

File tree

3 files changed

+34
-19
lines changed

3 files changed

+34
-19
lines changed

config/vanilla/bootstrap.before.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,4 +875,34 @@ function writeInlineCommentOptions($comment) {
875875
echo '</div>';
876876

877877
}
878+
}
879+
880+
if (!function_exists('discussionUrl')) {
881+
/**
882+
* Return a URL for a discussion. This function is in here and not functions.general so that plugins can override.
883+
*
884+
* @param object|array $discussion
885+
* @param int|string $page
886+
* @param bool $withDomain
887+
* @return string
888+
*/
889+
function discussionUrl($discussion, $page = '', $withDomain = true) {
890+
$discussion = (object)$discussion;
891+
$name = Gdn_Format::url($discussion->Name);
892+
893+
// Disallow an empty name slug in discussion URLs.
894+
if (empty($name)) {
895+
$name = 'x';
896+
}
897+
898+
$result = '/discussion/'.$discussion->DiscussionID.'/'.$name;
899+
900+
if ($page) {
901+
//if ($page > 1 || Gdn::session()->UserID) {
902+
$result .= '/p'.$page;
903+
// }
904+
}
905+
906+
return url($result, $withDomain);
907+
}
878908
}

vanilla/plugins/Quotes/class.quotes.plugin.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ public function profileController_afterAddSideMenu_handler($sender) {
8585
*
8686
* @param profileController $sender
8787
*/
88+
/*
8889
public function profileController_quotes_create($sender) {
8990
$sender->permission('Garden.SignIn.Allow');
9091
$sender->title(t("Quote Settings"));
@@ -140,7 +141,7 @@ public function profileController_quotes_create($sender) {
140141
141142
$sender->render('quotes', '', 'plugins/Quotes');
142143
}
143-
144+
*/
144145
/**
145146
* Set user's quote folding preference in the page for Javascript access.
146147
*

vanilla/plugins/Quotes/js/quotes.js

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Gdn_Quotes.prototype.GetEditor = function () {
105105
var editor = $(this.currentEditor);
106106
if (!document.body.contains(this.currentEditor) || !editor.length) {
107107
// FIX: https://github.com/topcoder-platform/forums/issues/83
108-
editor = $('.richEditor-textWrap').first();
108+
editor = $('.bodybox-wrap').first();
109109
}
110110

111111
return editor;
@@ -165,23 +165,7 @@ Gdn_Quotes.prototype.QuoteResponse = function(Data, Status, XHR) {
165165

166166
// Insert the quote text into the editor.
167167
Gdn_Quotes.prototype.ApplyQuoteText = function(QuoteText) {
168-
var Editor = this.GetEditor();
169-
170-
// First try and throw an event.
171-
Editor.trigger('appendHtml', QuoteText + '<br />');
172-
173-
QuoteText = QuoteText + '\n';
174-
Editor.val(Editor.val() + QuoteText);
175-
176-
// DEPRECATED: cleditor support
177-
if ($('div.cleditorMain').length) {
178-
Editor.val(Editor.val() + '<br/>');
179-
Editor.get(0).editor.updateFrame();
180-
}
181-
182-
Editor
183-
.focus()
184-
.trigger('autosize.resize');
168+
$(document).trigger('ApplyQuoteText', [QuoteText]);
185169
};
186170

187171
(function(window) {

0 commit comments

Comments
 (0)