Skip to content

Commit

Permalink
MBS-8802: Fix handling of title strings
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-csg committed Feb 13, 2024
1 parent 9b283d9 commit c8422c4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions classes/boardmanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ public function update_card(int $cardid, array $data): void {
];
// Do some extra sanitizing.
if (isset($data['title'])) {
$data['title'] = clean_param($data['title'], PARAM_TEXT);
$data['title'] = s($data['title']);
}
if (isset($data['description'])) {
$data['description'] = clean_param($data['description'], PARAM_CLEANHTML);
Expand Down Expand Up @@ -946,7 +946,7 @@ public function update_column(int $columnid, array $data): void {
'autohide' => $data['autohide'],
];
if (isset($data['title'])) {
$data['title'] = clean_param($data['title'], PARAM_TEXT);
$data['title'] = s($data['title']);
}
$columndata = [
'id' => $columnid,
Expand Down
8 changes: 3 additions & 5 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,15 @@ function kanban_inplace_editable($itemtype, $itemid, $newvalue) {

\mod_kanban\helper::check_permissions_for_user_or_group($boardmanager->get_board(), $context, $boardmanager->get_cminfo());

$newtitle = clean_param($newvalue, PARAM_TEXT);

if ($itemtype == 'card') {
$boardmanager->update_card($itemid, ['title' => $newtitle]);
$boardmanager->update_card($itemid, ['title' => $newvalue]);
}

if ($itemtype == 'column') {
$boardmanager->update_column($itemid, ['title' => $newtitle]);
$boardmanager->update_column($itemid, ['title' => $newvalue]);
}

return new \core\output\inplace_editable('mod_kanban', $itemtype, $itemid, true, $newtitle, $newtitle, null, '');
return new \core\output\inplace_editable('mod_kanban', $itemtype, $itemid, true, $newvalue, $newvalue, null, '');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion templates/card.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<span class="inplaceeditable inplaceeditable-text"{{#canedit}}{{^completed}} data-inplaceeditable="1" data-component="mod_kanban" data-itemtype="card" data-itemid="{{id}}"
data-value="{{title}}" data-type="text"{{/completed}}{{/canedit}}>
<a href="#" class="quickeditlink aalink"{{#canedit}}{{^completed}} data-inplaceeditablelink="1"{{/completed}}{{/canedit}}>
{{title}}
{{{title}}}
</a>
</span>
</div>
Expand Down
2 changes: 1 addition & 1 deletion templates/column.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<span class="inplaceeditable inplaceeditable-text"{{#managecolumns}} {{^locked}}data-inplaceeditable="1" {{/locked}}data-component="mod_kanban" data-itemtype="column" data-itemid="{{id}}"
data-value="{{title}}" data-type="text"{{/managecolumns}}>
<a href="#" class="quickeditlink aalink"{{#managecolumns}} data-inplaceeditablelink="1"{{/managecolumns}}>
{{title}}
{{{title}}}
</a>
</span>
</h5>
Expand Down

0 comments on commit c8422c4

Please sign in to comment.