-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/duplication #1180
base: doryphore-dev
Are you sure you want to change the base?
Feat/duplication #1180
Conversation
a9c4a8b
to
301df7f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WIP review, j'ai l'impression que github a perdu la moitié de mes commentaires..
-> edit c'est bon il les a gardé, je continue alors
<button name="duplicate-action" value="open" type="submit" class="btn btn-primary"><i class="fa fa-eye-open"></i>{{ _t('DUPLICATE_AND_OPEN') }}</button> | ||
<button name="duplicate-action" value="edit" type="submit" class="btn btn-primary"><i class="fa fa-pencil-alt"></i> {{ _t('DUPLICATE_AND_EDIT') }}</button> | ||
<button name="duplicate-action" value="return" type="submit" class="btn btn-primary"><i class="fa fa-arrow-left"></i> {{ _t('DUPLICATE_AND_RETURN') }}</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je trouve que ça complique l'interface d'avoir ces trois boutons, sans apporter de grand bénéfice à l'utilisateur
Je pense qu'on devrait toujours faire "duplicate & afficher" (pas besoin d'icone), et si ils veulent éditer ben ils cliquent éditer, si ils veulent revenir en arrière ils cliquent le bouton dédié dans le navigateur
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok je demande l'avis de @furax37 au cas ou, mais pas d'objection
handlers/DuplicateHandler.php
Outdated
]); | ||
} elseif (!$this->getService(AclService::class)->hasAccess('read', $this->wiki->GetPageTag())) { | ||
// if no read access to the page | ||
if ($contenu = $this->getService(PageManager::class)->getOne("PageLogin")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
le gars fait la description de sa PR en anglais mais utilise du francais dans le code, gnahaha :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
un peu de french touch dans la codebase!
$duplicationManager = $this->getService(DuplicationManager::class); | ||
try { | ||
$duplicationManager->importDistantContent($tag, $request); | ||
} catch (\Throwable $th) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pour info comme y'a un use Throwable
y'a pas besoin du \
@@ -16,14 +16,13 @@ | |||
use YesWiki\Core\Service\AclService; | |||
use YesWiki\Core\Service\ArchiveService; | |||
use YesWiki\Core\Service\CommentService; | |||
use YesWiki\Core\Service\DbService; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c'est une erreur d'avoir retiré cet import, c'est utilisé. J'ai fait un fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je croies que j'avais corrigé ca et le missing { mais j'ai pas du bien reprendre mon commit lors du cherry-pick
// find fields that are textareas | ||
foreach ($form['prepared'] as $field) { | ||
if ($field instanceof TextareaField or $field instanceof ImageField or $field instanceof FileField) { | ||
$fields[] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je pense qu'il vaudrait mieux retourner le $field entrier, plutot que ce tableau avec juste ID et TYPE, comme ça on sait ce que contient la variable juste avec le nom (un $field c'est un BazarField, pas un array [id, type]) et aussi plus loin dans le code ça évite des check un foireux du genre $field[type] == 'image', c'est mieux de refaire un $field instance of ImageField
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
heu cette classe est pas utilisée non? on dirait que les function sont déjà dans DuplicateManager
@@ -298,6 +297,7 @@ public function deleteOrphaned($tag) | |||
$this->dbService->query("DELETE FROM {$this->dbService->prefixTable('links')} WHERE from_tag='{$this->dbService->escape($tag)}' "); | |||
$this->dbService->query("DELETE FROM {$this->dbService->prefixTable('acls')} WHERE page_tag='{$this->dbService->escape($tag)}' "); | |||
$this->dbService->query("DELETE FROM {$this->dbService->prefixTable('triples')} WHERE `resource`='{$this->dbService->escape($tag)}' and `property`='" . TripleStore::TYPE_URI . "' and `value`='" . EntryManager::TRIPLES_ENTRY_ID . "'"); | |||
$this->dbService->query("DELETE FROM {$this->dbService->prefixTable('triples')} WHERE `resource`='{$this->dbService->escape($tag)}' and `property`='" . TripleStore::TYPE_URI . "' and `value`='" . EntryManager::TRIPLES_ENTRY_ID . "'"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pourquoi avoir dupliqué cette ligne?? si y'a une raison spécifique mieux vaut ajouter un commentaire pour expliquer parce ça fait bizarre :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je pense que c'est mon rebase foireux, il a du prendre les deux
}, $pages); | ||
|
||
return $pages; | ||
} | ||
|
||
private function duplicate($sourceTag, $destinationTag): bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?? un code de test? à supprimer non?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non je voulais creer une methode dans le PageManager, mais work in progress
function handleLoginResponse(data) { | ||
if (data.isAdmin === true) { | ||
$('#login-message').html(_t('CONNECTED_AS_ADMIN', { user: data.user })).parents('.form-group') | ||
.removeClass('has-error') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ah, old school ! on a VueJs maintenant hein :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je veux bien tenter une conversion en vue, mais je sens qu'il va falloir charger une lib pour les requetes ajax, mettre des methodes a la con etc, mais bon pourquoi pas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non non laisse ton code comme ça, maintenant qu'il est écrit ne va pas passer du temps à déjà le refactor !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yo !
top tout ça !
J'ai fait des petites remarques pour la forme, mais c'est pas du tout bloquant. y'a 2/3 commentaires à fixer cependant
J'ai poussé les petit fix, plus un passage de linter (ils étaient pas en place quand tu as commencé le boulot sur cette branche)
<div class="form-group"> | ||
<label for="urlWiki" class="control-label">{{ _t('WIKI_URL') }}</label> | ||
<div class="input-group"> | ||
<input required type="url" class="form-control" id="urlWiki" name="urlWiki" placeholder="{{ _t('WIKI_URL') }}" value="" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normalement on utilise du dash case pour les id aussi url-wiki
@@ -1180,4 +1180,11 @@ function ($attributeName) { | |||
|
|||
return $entriesIds; | |||
} | |||
|
|||
private function duplicate($sourceTag, $destinationTag): bool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pareil, test code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pareil methode de service non existante encore..
@@ -417,4 +417,3 @@ private function getExternalUrlsFromIds(?string $ids) | |||
|
|||
return $externalIds; | |||
} | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
petite boulette manque le } maintenant ! j'ai fixé :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
j'avais corrigé ailleurs ca.. mais merci pour le fix
@@ -36,6 +36,11 @@ | |||
</td> | |||
<td>{{ key }}</td> | |||
<td> | |||
{% if list.canDuplicate %} | |||
<a class="btn btn-default btn-xs" href="{{ url({ params: { vue: 'listes', action: 'duplicate', idliste: key }}) }}"> | |||
<i class="far fa-clone"></i> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On est d'accord c'est pas encore implémenté la duplication de liste? en tout cas chez moi ça marche pas :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oui ca vient
if (btnAction == 'open') { | ||
location = `${shortUrl}/?${data.pageTag}` | ||
} else if (btnAction == 'edit') { | ||
location = `${shortUrl}/?${data.pageTag}/edit` |
Check warning
Code scanning / CodeQL
DOM text reinterpreted as HTML Medium
DOM text
Ok merci pour cette revue, je vais tout prendre en compte, sauf peut etre la re--ecriture jquery vers vuejs, je ferai que si j'ai du temps. |
Description of pull request / Description de la demande d'ajout
90% finished feature of duplication of pages/lists in same wiki or to external wikis
After rebase from doryphore-dev i had some strange bugs, i tried to fix them, hopefully i got them all.
You can test the duplication feature on another wiki by giving url local dev url as url for duplication (it will use the api roads instead of the controller).
Sorry for the quite big codebase changes...
Edit: i can see what when wrong : there are two other beta-features included : an image optimizer, and extra-fields feature (that add comments and reactions to bazarlist if needed)
I will check if everything is working as expected, as it should also be reviewed, or do you prefer separated PRs ?