Unanticipated User Role setting causes error
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 38/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- php
- Ambito
- authorization, backend
Direzione di ricerca
Inizia da CommentingPlugin::showComments e confronta views/public/comments.php con il file proposto views/public/commentingHeader.php. Segui i controlli dei ruoli per la visualizzazione e l’aggiunta dei commenti, quindi verifica che un ruolo autorizzato a commentare ma non a visualizzare i commenti riceva comunque l’etichetta, il messaggio flash e il modulo per i commenti senza errori.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I came across an issue which gets triggered by the scenario that a certain User Role is able to make a comment, but not allowed to view them. In this case the $view variable along with $view->addHelperPath is not set since this is currently dependent on the ability to view comments. Also in this scenario the Label as well as the flash message does not get output, since they currently reside in views/public/comments.php, which gets bypassed.
To fix the issue, I updated the showComments function in CommentingPlugin to the following:
public static function showComments($args = array())
{
echo "<div id='comments-container'>";
// presume we will need the view in any case
if(isset($args['view'])) {
$view = $args['view'];
} else {
$view = get_view();
}
$view->addHelperPath(COMMENTING_PLUGIN_DIR . '/helpers', 'Commenting_View_Helper_');
// output the header
echo $view->partial('commentingHeader.php');
if( (get_option('commenting_allow_public') == 1)
|| (get_option('commenting_allow_public_view') == 1)
|| is_allowed('Commenting_Comment', 'show') ) {
$options = array('threaded'=> get_option('commenting_threaded'), 'approved'=>true);
$comments = isset($args['comments']) ? $args['comments'] : $view->getComments($options);
echo $view->partial('comments.php', array('comments'=>$comments, 'threaded'=>$options['threaded']));
}
if( (get_option('commenting_allow_public') == 1)
|| is_allowed('Commenting_Comment', 'add') ) {
echo "<div id='comment-main-container'>";
echo $view->getCommentForm();
echo "</div>";
}
echo "</div>";
}
This presumes that we need the $views set in any case.
I also created a new file views/public/commentingHeader.php which contains:
<?php $label = get_option('commenting_comments_label'); ?>
<?php if ($label == ''):?>
<h2><?php echo __('Comments'); ?></h2>
<?php else: ?>
<h2><?php echo $label; ?></h2>
<?php endif; ?>
<div id='comments-flash'><?php echo flash(true); ?></div>
This code has been removed from views/public/comments.php.
- Lingua principale
- PHP
- Stelle
- 4
- Fork
- 5
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di omeka/plugin-Commenting
-
Rearrange config Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
omeka/plugin-Commenting#59 ·
-
Recaptcha link doesn't work Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 45/100
omeka/plugin-Commenting#58 ·
-
User role issues Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
omeka/plugin-Commenting#57 ·
-
omeka/plugin-Commenting#41 · 1 assegnatario ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 20/100
omeka/plugin-Commenting#26 · 3 commenti ·
Tutte le issue di omeka/plugin-Commenting
Issue simili
-
tooling
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
UX
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
ProfessionalWiki/NeoWiki#1525 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
bug customer-reported
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
MagnaCapax/PMSS#949 ·
-
responsive-media kses allow-list strips clipPathUnits, collapsing objectBoundingBox clip paths Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
Automattic/static-site-importer#1829 ·