-
Notifications
You must be signed in to change notification settings - Fork 273
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: CCE user cannot update artifact sometimes
How to reproduce: Have an artifact A with a comment containing a cross reference to another artifact B like `See art #123`. In the tracker of the artifact A, upload a Custom Code Execution module in the administration. There is an example module if you need one: ``` cd plugins/tracker_cce/wasm_modules/post-action-add-comment nix-shell cargo build --target wasm32-wasi --release ``` Then you can upload the generated file: `plugins/tracker_cce/wasm_modules/post-action-add-comment/target/wasm32-wasi/release/post-action-add-comment.wasm` The example module take an integer field `field_a`, an integer field `field_b`, and fill a text field `field_sum`. You will need them for the test. Or use your own module. Now update the artifact A. The (async) execution of the module should be a success and a new comment is added to the artifact by CCE user. Closes request #35862: Artifact userCanView not properly cached Part of story #35093: execute custom code as artifact post action Change-Id: Id08ce6570c1dd2c7ebedcd70339f9d9d6b008d58
- Loading branch information
Showing
14 changed files
with
122 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
plugins/tracker/tests/unit/Tracker/Artifact/ArtifactTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* Copyright (c) Enalean, 2024 - Present. All Rights Reserved. | ||
* | ||
* This file is a part of Tuleap. | ||
* | ||
* Tuleap is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* Tuleap is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Tuleap. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tuleap\Tracker\Artifact; | ||
|
||
use Tuleap\Test\Builders\UserTestBuilder; | ||
use Tuleap\Test\PHPUnit\TestCase; | ||
|
||
final class ArtifactTest extends TestCase | ||
{ | ||
public function testUserCanViewCache(): void | ||
{ | ||
$artifact = new Artifact(1, 2, 3, 4, false); | ||
|
||
$bob = UserTestBuilder::anActiveUser()->withId(1)->build(); | ||
$alice = UserTestBuilder::anActiveUser()->withId(2)->build(); | ||
|
||
$artifact->setUserCanView([ | ||
$bob->getId() => false, | ||
$alice->getId() => true, | ||
]); | ||
|
||
self::assertFalse($artifact->userCanView($bob)); | ||
self::assertTrue($artifact->userCanView($alice)); | ||
} | ||
} |
Oops, something went wrong.