* @param Notice $notice
* @param HTMLOutputter $out
*/
-
+
function showNotice($notice, $out)
{
switch ($notice->object_type) {
function showNoticeAnswer($notice, $out)
{
$user = common_current_user();
-
+
$answer = QnA_Answer::getByNotice($notice);
$question = $answer->getQuestion();
common_log(LOG_DEBUG, "Saving question: $q->id $q->uri");
$q->insert();
- // TRANS: Notice content creating a question.
- // TRANS: %1$s is the title of the question, %2$s is a link to the question.
- $content = sprintf(
- _m('question: %1$s %2$s'),
- $title,
- $q->uri
- );
+ if (Notice::contentTooLong($q->title . ' ' . $q->uri)) {
+ $max = Notice::maxContent();
+ $uriLen = mb_strlen($q->uri);
+ $targetLen = $max - ($uriLen + 15);
+ $title = mb_substr($q->title, 0, $targetLen) . '…';
+
+ }
+
+ $content = $title . ' ' . $q->uri;
- $link = '<a href="' . htmlspecialchars($q->uri) . '">' . htmlspecialchars($title) . '</a>';
+ $link = '<a href="' . htmlspecialchars($q->uri) . '">' . htmlspecialchars($q->title) . '</a>';
// TRANS: Rendered version of the notice content creating a question.
// TRANS: %s a link to the question as link description.
$rendered = sprintf(_m('Question: %s'), $link);