This is a really minor bug, if you try to duplicate a view an input field gives you the option to alter the name. Once you've decided a fancy new name and click duplicate, you will see the next page with the correct machine_name, but the view name is still the old one.

Reproduce:
* open admin/structure/views
* use the menu to duplicate any view (forward to admin/structure/views/view/content/duplicate)
* enter a fancy name and click duplicate

Result: your new view has the old name

Comments

dawehner’s picture

Version: 8.0.0-beta1 » 8.0.x-dev
Issue tags: -#views #duplicate

Good observation!

Do you want to try to fix it? core/modules/views_ui/src/ViewDuplicateForm.php would be the URL you need.

zaporylie’s picture

Assigned: Unassigned » zaporylie

I will provide a patch

zaporylie’s picture

Status: Active » Needs review
StatusFileSize
new637 bytes

Lets try

lhangea’s picture

Status: Needs review » Reviewed & tested by the community

Tested the patch. It fixes the problem.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

So we must be missing test coverage of this.

zaporylie’s picture

That's what I thought :) I will provide one later today or tomorrow.

zaporylie’s picture

Issue tags: +dcwroc2014
zaporylie’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
StatusFileSize
new1.93 KB

Ok, here's the patch. This is my very first Test class so, please, review it carefully.

zaporylie’s picture

Assigned: zaporylie » Unassigned
dawehner’s picture

  1. +++ b/core/modules/views_ui/src/Tests/CloneTest.php
    @@ -0,0 +1,41 @@
    +/**
    + * @file
    + * Contains \Drupal\views_ui\Tests\CloneTest.
    + */
    +
    ...
    + * Tests view clone tool.
    + *
    + * @group views_ui
    + */
    +class CloneTest extends UITestBase {
    ...
    +  public function testCloneView() {
    +
    

    It would be great if we could name things here as duplicate, given that also the UI is talking about duplicating.

  2. +++ b/core/modules/views_ui/src/ViewDuplicateForm.php
    @@ -73,6 +73,7 @@ protected function actions(array $form, FormStateInterface $form_state) {
    +    $this->entity->set('label', $form_state->getValue('label'));
    

    +1

zaporylie’s picture

Thanks for review. I've changed name convention from clone to duplicate.

jsobiecki’s picture

+1 from me. Patch applies cleanly, all tests are green and what most important - it fixes reported bug :).

From technical side - change is quite simple - nothing suspicious here. Patch includes also new test case for test suite.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Cool, thank you!

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 5a3027c and pushed to 8.0.x. Thanks!

  • alexpott committed 5a3027c on 8.0.x
    Issue #2357925 by zaporylie | R. Volk: Fixed Duplicate view copies the...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.