1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-25 08:12:40 +01:00
Commit graph

17624 commits

Author SHA1 Message Date
9a5643253b
docs/file_domain: Update cloudflare spelling and URLs
Summary:
Cloudflare now spell themselves as `Cloudflare`.[1]

[1]: https://www.cloudflare.com/trademark/

Signed-off-by: Yongmin Hong <revi@omglol.email>

Test Plan: Read the Docs ™️.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25616
2024-05-07 13:01:39 +00:00
Andre Klapper
960a1ab1ec Facts: Fix displaying charts for anonymous users
Summary:
Charts in the Facts prototype application (e.g. as a Burndown chart on a project's Reports page) remained empty for users not logged in: payload response was a login dialog instead of actual data to render. Thus set `shouldAllowPublic()` (as for many other Controllers).

Closes T15436

Test Plan:
* As an admin, enable the Facts prototype application.
* As an admin, set "Can Use Application" to "Public" for Projects on http://phorge.localhost/applications/view/PhabricatorProjectApplication/
* As an admin, set "Can Use Application" to "Public" for Facts on http://phorge.localhost/applications/view/PhabricatorFactApplication/
* Go to a project with tasks; select "Reports (Prototype)" in the sidebar
* Both as a logged in and as an anonymous user, check if the charts render.
* Click the `View Chart` option and both as a logged in and as an anonymous user, check if the charts render at an URI like http://phorge.localhost/fact/chart/a1b2c3d4e5f6/
* As an admin, restrict "Can Use Application" to "Users" for Facts on `/applications/view/PhabricatorFactApplication/`
* As an anonymous user, check that http://phorge.localhost/fact/chart/a1b2c3d4e5f6/ requires a login now.
* As an anonymous user, check that charts on http://phorge.localhost/project/reports/1/ remain empty boxes (which is not ideal but not a big difference to beforehand).

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15436

Differential Revision: https://we.phorge.it/D25608
2024-05-05 17:35:35 +02:00
Waldir Pimenta
c8fb504690 Fix the whitespace issue in the message "Access Denied: Restricted File"
Summary:
Added whitespaces where missing in the restricted file message.

Closes T15270

Test Plan: Access a forbidden file. Check whitespaces in the error message.

Reviewers: O1 Blessed Committers, valerio.bozzolan, aklapper, waldyrious

Reviewed By: O1 Blessed Committers, valerio.bozzolan, waldyrious

Subscribers: aklapper, waldyrious, avivey, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Tags: #ux

Maniphest Tasks: T15270

Differential Revision: https://we.phorge.it/D25419
2024-05-05 14:00:26 +03:00
Andre Klapper
81653abb54 Fix PHP 8.1 "strlen(null)" exceptions adding an OAuth provider
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php:140]
```

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php:155]
```

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/auth/provider/PhabricatorOAuth2AuthProvider.php:165]
```

Closes T15786

Test Plan: Set up any Auth provider which uses OAuth2 and check the error console.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15786

Differential Revision: https://we.phorge.it/D25578
2024-05-03 15:10:19 +02:00
Andre Klapper
84c57f5e57 Fix exception trying to export empty task list to CSV
Summary:
Check that we have objects with PHIDs before running a query. If there are none, return an empty array instead.

```
EXCEPTION: (Exception) Edge list passed to "withSourcePHIDs(...)" is empty, but it must be nonempty. at [<phorge>/src/infrastructure/edges/query/PhabricatorEdgeQuery.php:50]
```

Closes T15789

Test Plan:
* Log into Phorge, go to http://phorge.localhost/maniphest/query/assigned/ and make sure you have zero assigned tasks.
* Click "Use Results" and select "Export Data".
* In the "Export Results" dialog, keep default Format = csv and click "Download Data".
* After applying the patch, get the expected dialog "Download File - Download file assigned.csv (264 B)?" and resulting file with only column headers and no data, instead of an unhandled exception.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15789

Differential Revision: https://we.phorge.it/D25613
2024-05-02 10:29:14 +02:00
Andre Klapper
279ed1ee76 Fix PHP 8.1 "strlen(null)" exception in PhabricatorPasteLanguageTransaction.php
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

Closes T15808

Test Plan: Unknown. Given that the function rendering `$value` is later called to construct a title string passed to `pht()` I assume that it should be a string and not a scalar.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15808

Differential Revision: https://we.phorge.it/D25611
2024-05-02 10:28:08 +02:00
Andre Klapper
488960ae7a Fix PHP 8.1 "strlen(null)" exception in PhabricatorStandardCustomFieldLink.php
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

Closes T15807

Test Plan: Unknown. Given that `$value` is later used to construct a `phutil_tag` I assume that it should be a string and not a scalar.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15807

Differential Revision: https://we.phorge.it/D25610
2024-05-02 10:26:13 +02:00
Andre Klapper
fbe07fbeef Convert "Page Size" field in Maniphest Advanced Search to PhabricatorSearchIntField
Summary:
Convert the "Page Size" field from PhabricatorSearchTextField to PhabricatorSearchIntField as its input should be an integer value (the number of tasks to display in the query results).

Closes T15723

Test Plan:
* Go to `/maniphest/query/advanced/`
* enter random values in the `Page Size` field and run random Maniphest queries (example values:  `13`, `0`, `-13`, `foobar`, `foo13bar`, `-foo1313`, `13.5`, `-13.5`, `13,5`, `-13,5`, `-`, `-0`).

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15723

Differential Revision: https://we.phorge.it/D25527
2024-05-02 10:16:14 +02:00
Andre Klapper
74e28bc2a7 Reports: Remove unused variable
Summary: This variable feels unneeded in this function. It may have a better and more fulfilling life after finding a new function.

Test Plan: Read slowly and aloud all code in the function.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25609
2024-05-01 11:44:27 +02:00
Andre Klapper
2cc94023ff Update URI in bugtraq.logregex description
Summary: HTTPS makes the world a safer place.

Test Plan: Go to `/config/edit/bugtraq.logregex/` and click the URI in the description. Carefully compare what you clicked and where you ended up. Perhaps the real treasure was the friends you made along the way?

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25606
2024-05-01 11:42:26 +02:00
Andre Klapper
6ab2b56a1a PhutilRemarkupHexColorCodeRule: Do not assume that parameter is a string
Summary:
Check type before potentially mangling HTML in a PhutilSafeHTML element.
For now, do not try to apply this renderer when not dealing with a plain string.

Closes T15802

Test Plan: After deleting the corresponding MarkupCache via `DELETE FROM phabricator_cache.cache_markupcache WHERE cacheData LIKE "%whatever description on the page%";` check the description of a page, e.g. of `/config/edit/security.require-https/` or `/config/edit/storage.default-namespace/`.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15802

Differential Revision: https://we.phorge.it/D25605
2024-04-30 09:28:20 +02:00
Valerio Bozzolan
3367fe0017 Drag & Drop Task Cover Image: also attach
Summary:
After this change, the cover image is finally always visible to others (to people who can see the Task)
instead of being visible only to yourself.

Example conversation before this change:

- Anna: (uploads a nice Cover Image on the Task, using drag & drop from the Workboard)
- Bob: Thanks! But I cannot see that image. Please change visibility.
- Anna: Ouch! How?
- Bob: I don't know. Try Files > your File > Edit > Set Visibility > Something that includes "Bob".
- Anna: Done. Do you see my image now? (Spoiler: it's a green pepper)
- Bob: Yes and no. I mean, I can see the original file, but not from the Workboard.
- Anna: Uh? Have you tried refreshing your cache?
- Bob: Yes. Still invisible from Workboard.
- Anna: Maybe you have to change Defaults Permissions of the "Files" Application, to have "All Users"
- Bob: That is a bit invasive. Let's try. I changed the Files policy globally. Try re-uploading your image again.
- Anna: Done. Do you see it now?
- Bob: Yes! I can finally see it now, also from the Workboard.

Example conversation after this change:

- Anna: (uploads a nice Cover Image on the Task, using drag & drop from the Workboard)

Done! So, after this change, everything works as expected. Every task participant can see that image,
and nobody starts a nonsense conversation, and nobody needs to do random experiments with
default application policies.

So, after this change:

- the original file is attached to the Task
- the cover image is not orphan anymore, but mentioned in the "Transforms" of the original file
- the cover image so now inherits the original file policies

So, Task participants can finally see that cover image (transform), since it comes from a file,
and that file is attached to the Task, and since they can see that Task.

For a micro-optimization, this change refactors a bit PhabricatorFile.

You can still work in object-oriented:

    lang=php
    $file->attachToObject($task_phid);

But now you can also work directly with PHIDs, if necessary:

    lang=php
    PhabricatorFile::attachFileToObject($file_phid, $task_phid)

This patch somehow improves T15768.

Closes T15163
Closes T15703

Test Plan:
Visit a Workboard with a Column and a Task. Then:

1. Drag & Drop GNU.png from your computer to that Task
2. Drag & Drop GNU.png again there
3. Drag & Drop Linux.png to that Task
4. Drag & Drop Linux.png again
5. No nuclear implosion.
6. In all cases Task participants can see your Cover Image.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15163, T15703

Differential Revision: https://we.phorge.it/D25475
2024-04-29 17:34:40 +02:00
Aviv Eyal
f75c7ce766 arc liberate
Summary: See Q134; Introduced in D25598.

Test Plan: unit tests

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25603
2024-04-28 19:54:13 +03:00
Andre Klapper
4da88848be Fix exception accessing a non-existing EditEngine
Summary:
Trying to access a non-existing edit engine "foo" via the URI `/transactions/editengine/foo/` throws an unhandled exception.
`PhabricatorEditEngine::getByKey($viewer, $engine_key)` is null as `$engine_key` is non-existing `foo`.
Thus avoid calling `setViewer()` on `null` by splitting into a separate step after a null check.
When null, show a proper 404 error instead.

```
EXCEPTION: (Error) Call to a member function setViewer() on null at [<phorge>/src/applications/transactions/controller/PhabricatorEditEngineConfigurationListController.php:17]
```

Closes T15793

Test Plan:
While logged in and with sufficient permissions,
* go to non-existing http://phorge.localhost/transactions/editengine/whatever/ before and after applying patch,
* go to existing http://phorge.localhost/transactions/editengine/maniphest.task/ to see that existing stuff still works.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15793

Differential Revision: https://we.phorge.it/D25597
2024-04-26 14:33:29 +02:00
Andre Klapper
93c7444d5c Fix PHP 8.1 "strlen(null)" exception mass-editing tasks when custom Date field present
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php:113]
```

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldDate.php:120]
```

Closes T15794

Test Plan:
Define a date field in maniphest.custom-field-definitions, have more than 100 Maniphest tasks, and select some to bulk-edit them. Example config:

    lang=json
    {
      "mycompany.deadline": {
        "name": "Deadline",
        "type": "date",
        "caption": "Estimated deadline.",
        "search": true
      }
    }

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15794

Differential Revision: https://we.phorge.it/D25599
2024-04-26 13:00:24 +02:00
Andre Klapper
b32b84b645 Fix exception for anonymous viewers on dashboard query panels with user-specific data
Summary:
When a viewer is not logged in and opens a public dashboard which embeds a query panel whose data requires a Current Viewer context (e.g. assigned or authored tasks, or joined projects), do not throw an exception but show an explanatory placeholder sentence (similar to already existing 'No tasks found.' or 'No documents found.' strings).

```
EXCEPTION: (Exception) Query "assigned" is unknown to application search engine "ManiphestTaskSearchEngine"! at [<phorge>/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php:80]
EXCEPTION: (Exception) Query "joined" is unknown to application search engine "PhabricatorProjectSearchEngine"! at [<phorge>/src/applications/dashboard/paneltype/PhabricatorDashboardQueryPanelType.php:80]
```

Closes T15792

Test Plan: While logged in, set up a dashboard query panel with "Search For: Maniphest Tasks" and "Query: Assigned" and add it to a public Dashboard. While logged out, access the Dashboard and see explanation message instead of `Exception: Query "assigned" is unknown to application search engine "ManiphestTaskSearchEngine"!` on the dashboard.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15792

Differential Revision: https://we.phorge.it/D25598
2024-04-26 12:54:35 +02:00
Mukunda Modell
4d12d014fd Add PhutilRemarkupHexColorCodeRule, a new remarkup rule to format color codes
Summary:
Implements a remarkup rule that formats the background color to match the value of inline hex color codes.

The format for this rule looks like `{#RRGGBB}` and it will be formatted the same as monospace text, so `#RRGGBB` with the background set to the specified color.

Test Plan:
* run `arc unit` and see the tests pass
* create some markup with {#ff0000} color codes for all of your favorite colors {#ee33ee}

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, aklapper, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15744

Differential Revision: https://we.phorge.it/D25540
2024-04-23 16:45:10 -05:00
Andre Klapper
5444e1c885 Fix PHP 8.1 "strlen(null)" exception for "/bin/storage renamespace" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

This patch also fixes two similar strlen() occurrences in the same source file.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementRenamespaceWorkflow.php:62]
```

Test Plan: Run `../phorge/bin/storage renamespace`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify the dumpfile to read with "--input", or use "--live" to generate one automatically.`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25592
2024-04-17 13:12:40 +02:00
Andre Klapper
5fe2fc33fb Fix PHP 8.1 "strlen(null)" exception for "/bin/almanac register" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

This patch also fixes two similar strlen() occurrences in the same source file.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/almanac/management/AlmanacManagementRegisterWorkflow.php:41]
```

Test Plan: Run `../phorge/bin/almanac register`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify a device with --device.`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25591
2024-04-17 13:12:16 +02:00
Andre Klapper
db3e68137d Fix PHP 8.1 "strlen(null)" exception for "/bin/aphlict notify" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

This patch also fixes another similar strlen() occurrence in the same source file.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/aphlict/management/PhabricatorAphlictManagementNotifyWorkflow.php:29]
```

Test Plan: Run `../phorge/bin/aphlict notify`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify a user to notify with "--user".`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25590
2024-04-17 13:11:07 +02:00
Andre Klapper
85903f968f Fix PHP 8.1 "strlen(null)" exception for "/bin/bulk export --query --format" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

This patch also fixes two similar strlen() occurrences in the same source file.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php:167]
```

Test Plan: Run `../phorge/bin/bulk export --query --format`: Get no `strlen()` error anymore but only expected output `Usage Exception: Query "--format" is unknown. To run a builtin query like "all" or "active", also specify the search engine with "--class".`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25588
2024-04-17 13:10:10 +02:00
Andre Klapper
412c01ffa6 Fix PHP 8.1 "strlen(null)" exception for "/bin/auth cache-pkcs8" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

This patch also fixes another similar strlen() occurrence in the same source file.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php:35]
```

Test Plan: Run `../phorge/bin/auth cache-pkcs8`: Get no `strlen()` error anymore but only expected output `Usage Exception: You must specify the path to a public keyfile with --public.`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25587
2024-04-17 13:08:30 +02:00
Andre Klapper
0e53f91c97 Fix PHP 8.1 "strlen(null)" exception for "/bin/herald test" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

This patch also fixes another similar strlen() occurrence in the same source file.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/herald/management/HeraldTestManagementWorkflow.php:33]
```

Test Plan: Run `../phorge/bin/herald test`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify an object to test rules for with "--object".`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25586
2024-04-17 13:08:05 +02:00
Andre Klapper
d630f2281b Fix PHP 8.1 "strlen(null)" exception for "/bin/conduit call" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

This patch also fixes two similar `strlen()` occurrences in the same source file.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/conduit/management/PhabricatorConduitCallManagementWorkflow.php:44]
```

Test Plan: Run `../phorge/bin/conduit call`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify a method to call with "--method".`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25584
2024-04-17 13:07:30 +02:00
Andre Klapper
98cbf5fa19 Fix PHP 8.1 "strlen(null)" exception for "/bin/files encode" without --as parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/files/management/PhabricatorFilesManagementEncodeWorkflow.php:45]
```

Test Plan: Run `../phorge/bin/files encode F1`: Get no `strlen()` error anymore but only expected output `Usage Exception: Use --as <format> to select a target encoding format. Available formats are: aes-256-cbc, rot13, raw.`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25595
2024-04-17 09:16:58 +02:00
Andre Klapper
0bdfcc47e7 Fix PHP 8.1 "strlen(null)" exception for "/bin/files migrate" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/files/management/PhabricatorFilesManagementMigrateWorkflow.php:65]
```

Test Plan: Run `../phorge/bin/files migrate`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify an engine to migrate to with `--engine`. Use `files engines` to get a list of engines.`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25594
2024-04-17 09:16:33 +02:00
Andre Klapper
c59a883e9d Fix PHP 8.1 "strlen(null)" exception for "/bin/herald rule" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/herald/management/HeraldRuleManagementWorkflow.php:36]
```

Test Plan: Run `../phorge/bin/herald rule`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify a rule to edit with "--rule <id|monogram>".`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25585
2024-04-17 00:41:13 +02:00
Andre Klapper
b29e5aa7ca Fix PHP 8.1 "strlen(null)" exception for "/bin/search query" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/search/management/PhabricatorSearchManagementQueryWorkflow.php:24]
```

Test Plan: Run `../phorge/bin/search query`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify a query with --query.`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25589
2024-04-17 00:40:29 +02:00
Andre Klapper
102c43fb6a Fix PHP 8.1 "strlen(null)" exception for "/bin/auth refresh" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/auth/management/PhabricatorAuthManagementRefreshWorkflow.php:37]
```

Test Plan: Run `../phorge/bin/auth refresh`: Get no `strlen()` error anymore but only expected output `Found 3 account(s) to refresh.` (or similar)

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25583
2024-04-17 00:38:16 +02:00
Andre Klapper
2c7be156a8 Fix PHP 8.1 "strlen(null)" exception for "/bin/auth unlimit" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/auth/management/PhabricatorAuthManagementUnlimitWorkflow.php:30]
```

Test Plan: Run `../phorge/bin/auth unlimit`: Get no `strlen()` error anymore but only expected output `Usage Exception: Use --user to choose a user to reset actions for.`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25582
2024-04-17 00:37:32 +02:00
Andre Klapper
9101c0b63d Fix PHP 8.1 "strlen(null)" exception for "/bin/nuance update" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/nuance/management/NuanceManagementWorkflow.php:69]
```

Test Plan: Run `../phorge/bin/nuance update`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify a item with --item.`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25581
2024-04-17 00:35:44 +02:00
Andre Klapper
6a2f2a589a Fix PHP 8.1 "strlen(null)" exception for "/bin/nuance import" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/nuance/management/NuanceManagementWorkflow.php:8]
```

Test Plan: Run `../phorge/bin/nuance import`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify a source with --source.`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25580
2024-04-17 00:35:05 +02:00
Andre Klapper
05798a6301 Fix PHP 8.1 "strlen(null)" exception for "/bin/files generate-key" without parameter
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/files/management/PhabricatorFilesManagementGenerateKeyWorkflow.php:23]
```

Test Plan: Run `../phorge/bin/files generate-key`: Get no `strlen()` error anymore but only expected output `Usage Exception: Specify the type of key to generate with --type.`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25579
2024-04-17 00:29:24 +02:00
Andre Klapper
79464882da Fix PHP 8.1 "addcslashes(null)" exception exporting task list to tab-separated text
Summary:
When a column value to export to Tab-Separated Text is empty, `null` is passed to `addcslashes()` which is deprecated behavior since PHP 8.1.
Thus only call `addclashes()` when the value is set.

```
ERROR 8192: addcslashes(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/infrastructure/export/format/PhabricatorTextExportFormat.php:45]
```

Closes T15771

Test Plan: Export a Maniphest task list of query results to Tab-Separated Text.

Reviewers: O1 Blessed Committers, 20after4, speck

Reviewed By: O1 Blessed Committers, 20after4, speck

Subscribers: avivey, speck, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15771

Differential Revision: https://we.phorge.it/D25568
2024-04-15 16:42:22 +02:00
Aviv Eyal
0d9ca2589f Make sure offset is an integer
Summary:
Older git versions allowed the `--skip` to get empty string as value and interpreted that to an int.
We were sending `null` in some places where we wanted a `0`, so it all worked out.

Since https://git.kernel.org/pub/scm/git/git.git/commit/revision.c?id=71a1e94821666909b7b2bd62a36244c601f8430e git fails when provided empty string for an integer.

See Q124 and T15783.

Test Plan: Have recent git version (that fails with `--skip ''`, navigate to `/diffusion/1/history/master/`) - see history.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: aklapper, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25575
2024-04-12 19:28:16 +03:00
603c877fa0 Fix phacility link for arcanist guides
Summary: Signed-off-by: Yongmin Hong <revi@pobox.com>

Test Plan: Checkout https://we.phorge.it/book/phorge/article/arcanist and https://we.phorge.it/book/phorge/article/arcanist_quick_start/ and verify the new clone URL.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25573
2024-04-11 17:38:01 +00:00
Andre Klapper
5a5c456264 Correct docs of PhabricatorPHIDType::getAllTypesForApplication()
Summary: The signature and return type of the `getAllTypesForApplication()` function differed from its docs.

Test Plan: Carefully read the code of the function and compare it to the `getAllInstalledTypes()` function above from which the docs were incorrectly copied.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25572
2024-04-08 13:14:01 +02:00
Aviv Eyal
ecbef3fdf4 Show rest of task page when graph errors out
Summary: T15772.

Test Plan: Add a `throw` statement in graph calculation, load a task that has a graph, see message.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25570
2024-04-05 13:26:38 +03:00
Andre Klapper
644f179dd2 Make incoming mail handling more robust / correct
Summary:
* Properly handle when no mail headers at all can be parsed
* Properly handle when mail headers can be parsed but no subject line can be found

```
EXCEPTION: (RuntimeException) Undefined index: subject
```

Closes T15769

Test Plan: See T15769

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: 20after4, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15769

Differential Revision: https://we.phorge.it/D25565
2024-04-04 22:19:54 +02:00
Andre Klapper
c0bc453405 Fix PHP 8.1 "preg_match(null)" exception exporting task list to CSV
Summary:
When a column value to export to CSV is empty, `null` is passed to `preg_match()` which is deprecated behavior since PHP 8.1.
Thus only call `preg_match()` when the value is set.

```
ERROR 8192: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [/var/www/html/phorge/phorge/src/infrastructure/export/format/PhabricatorCSVExportFormat.php:51]
```

```
ERROR 8192: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [/var/www/html/phorge/phorge/src/infrastructure/export/format/PhabricatorCSVExportFormat.php:55]
```

Closes T15770

Test Plan: Export a Maniphest task list of query results to CSV.

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15770

Differential Revision: https://we.phorge.it/D25567
2024-04-03 11:57:25 +02:00
Katie
d4af32c1d4 Fix setup check for gzip request mangling being sent as GET
Summary:
Certain web servers (or cache layers such as Varnish) strip the body
of GET requests, resulting in the setup check failing when it would
otherwise function normally if a request is sent as POST.

Test Plan:
Phorge will no-longer mark the test as failing due to the body of a GET request being dropped.
As per RFC7231, certain implementations of HTTP/1.1 may reject the request or drop the payload
due to a previous revision of the spec where the body was supposed to be ignored (RFC2616, section 4.3)

Reviewers: O1 Blessed Committers, 20after4, speck, avivey

Reviewed By: O1 Blessed Committers, 20after4, speck, avivey

Subscribers: speck, 20after4, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25566
2024-04-02 21:49:00 +03:00
Benjamin Kausch
ba835fe0ec Seperate repository home and browse view in tab menu
Summary:
The tab menu in a repository can be a bit confusing. The first tab will be rendered active for two distinctive states:

- the home view in the currently selected branch
- the browse view in the currently selected branch

This diff will give the home view a dedicated extra tab. When switching the branches, we won't switch between home and browse view like it is done now.

And I have changed the crumb text for the browse view to "Code" to match it up with the tab name.

Additionally the readme is now the first content on the home view.

Fixes T15728

Test Plan: Browse in your favorite repos and feel an UX elevation.

Reviewers: O1 Blessed Committers, avivey, valerio.bozzolan

Reviewed By: O1 Blessed Committers, avivey, valerio.bozzolan

Subscribers: avivey, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15728

Differential Revision: https://we.phorge.it/D25538
2024-04-02 15:56:43 +02:00
Andre Klapper
713188bf17 Fix PHP 8.1 "strlen(null)" exception querying project tags for autocomplete without additional hashtag slugs defined
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/project/typeahead/PhabricatorProjectDatasource.php:99]
```

Closes T15761

Test Plan: Go to a task, enter `#` and start typing a project tag of a project which has no additional slugs defined.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15761

Differential Revision: https://we.phorge.it/D25556
2024-04-01 10:40:34 +02:00
Andre Klapper
a69db10c5e Fix "Creation of dynamic property is deprecated" PHP 8.2 error in MimeMailParser
Summary:
Add `#[AllowDynamicProperties]` attribute to avoid the deprecation notice.

See https://php.watch/versions/8.2/dynamic-properties-deprecated

```
# ERROR 8192: Creation of dynamic property MimeMailParser::$parts is deprecated at [/var/www/html/phorge/phorge/externals/mimemailparser/MimeMailParser.class.php:137]
#  #0 MimeMailParser::parse() called at [<phorge>/externals/mimemailparser/MimeMailParser.class.php:126]
```

Closes T15765

Test Plan: See T15765

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15765

Differential Revision: https://we.phorge.it/D25563
2024-03-31 15:25:03 +02:00
Andre Klapper
186768ccfd Fix PHP 8.1 "strlen(null)" exception when received email lacks From header
Summary:
`strlen()` was used in Phabricator to check if a generic value is a non-empty string.
This behavior is deprecated since PHP 8.1. Phorge adopts `phutil_nonempty_string()` as a replacement.

Note: this may highlight other absurd input values that might be worth correcting
instead of just ignoring. If phutil_nonempty_string() throws an exception in your
instance, report it to Phorge to evaluate and fix that specific corner case.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/metamta/storage/PhabricatorMetaMTAReceivedMail.php:527]
```

Closes T15767

Test Plan: See T15767

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15767

Differential Revision: https://we.phorge.it/D25564
2024-03-31 15:21:11 +02:00
Valerio Bozzolan
5263d5d590 Custom integer fields: fix search by array of possible values
Summary:
This minimal changes seems the natural expansion of this search function,
that "seems" designed to only search with a single value, but the backend
is designed to receive an array of possible values.

Look at the same method in PhabricatorStandardCustomFieldLink that already
works also for array inputs.

To get extra confidence look at the method withApplicationSearchContainsConstraint()
that works perfectly with arrays (to be honest it only works with arrays in mind...)

This feature allows to avoid crashes when extension developers tries to run "IN" queries
because for example they try to follow our performance guidelines:

https://we.phorge.it/book/contrib/article/n_plus_one/

Closes T15752

Test Plan:
Have a nice custom integer field, like this one for Maniphest:

    {
      "mycompany.estimated-hours": {
        "name": "Estimated Hours",
        "type": "int",
        "caption": "Estimated number of hours this will take.",
        "search": true
      }
    }

You can reproduce T15752 before the change. It just works after the change.

Or, just trust your instincts by looking at the same method in PhabricatorStandardCustomFieldLink.

Also, use the "normal" frontend search page. Still works as usual.

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15752

Differential Revision: https://we.phorge.it/D25554
2024-03-30 12:14:27 +01:00
Valerio Bozzolan
48e121c485 Config Projects Extra Fields: link to the doc (like User)
Summary:
Add a documentation link in a specific Config page, that is:

Config > Setting > projects.custom-field-definitions

Comparison example:

| User      | People     |
|-----------|------------|
|{F1633919} | {F1633920} |

This change is a boring follow-up of this one:

https://we.phorge.it/D25507

Test Plan:
Visit the page and click on the new link:

- /config/edit/projects.custom-field-definitions/

Visit this page that was the inspirational page:

- /config/edit/user.custom-field-definitions/

Check that no nuclear implosion is raised.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25552
2024-03-29 08:26:25 +01:00
Aviv Eyal
216d308507 Fix Project Hovercard rendering @mention
Summary:
Fix T15762. There's a complex interaction with project's AutoCapability requiring the membership info
to be already loaded, and the Mention rule assuming any project is fully loaded before trying to check
permissions.

As far as I can tell, the "contextObject" is currently used only to make the mention handle gray if
the mentioned user can't see it.

Test Plan: Load a Project's hovercard that @mentions a user that can't see the project - no crash.

Reviewers: aklapper, O1 Blessed Committers

Reviewed By: aklapper, O1 Blessed Committers

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15762

Differential Revision: https://we.phorge.it/D25562
2024-03-26 20:07:49 +02:00
Valerio Bozzolan
b1ae1b1a67 Remarkup code blocks: guess language from "name="
Summary:
The file name is a sufficient source of information, if available.

Closes T15729

Test Plan: The new unit test is green. Old unit tests are green.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15729

Differential Revision: https://we.phorge.it/D25560
2024-03-26 11:20:23 +01:00
Valerio Bozzolan
27f4b8321a Fix important regression in search engine
Summary:
Interestingly Phorge allows to paste a Phorge URL in the search bar to be redirected there...

Now this interesting feature was crashing the whole search engine for simple queries like "asdasd"
with the following exception message:

    Refusing to redirect to local resource "asdasd". This URI is not formatted in a recognizable way.

You are affected by this crash after this commit:

328aee033f

This specific commit is probably legitimate since "#asdasd" and "/asdasd" are indeed internal URIs,
plus, yes, there are some undocumented and untested cases like "asdasd" that may be considered
internal URIs as well. Or not. But this is just an undocumented corner-case.

In short:

PhabricatorDatasourceURIEngineExtension should not be built over undocumented corner-cases and
should require an absolute URI, with at least a domain.

Note that PhutilURI#getDomain() is always a string and never null, so we can do a strict check.

This fix also involves a micro-optimization to avoid duplicate URI parsing. Since the method was calling
the constructor PhutilURI(string) twice (line 13, line 24). Now just once.

Closes T15763

Test Plan:
Search "lol", no crash anymore.

Copy a random Phorge URL and paste that in your search bar. It still redirects there.

Reviewers: zhe, avivey, O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15763

Differential Revision: https://we.phorge.it/D25561
2024-03-26 07:30:10 +01:00