1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 00:32:42 +01:00
Commit graph

16060 commits

Author SHA1 Message Date
Valerio Bozzolan
89dcbe125c Panels list: fix missing welcome page
Summary:
The method getNewUserBody() was never designed for a list controller.
The method was just orphan. Now, instead, it's non-orphan, and it works
as expected.

This bug was highlighted by Andre Klapper, since their linter was screaming
about inconsistences in the current nonsense usage of getNewUserBody():

D25649

The code was just moved from the list controller, to the search engine.

- PhabricatorDashboardPanelListController (from)
- PhabricatorDashboardPanelSearchEngine (to)

Bonus point:

Adjusted the icon and the title to talk about "Panels" and not "Dashboards".

Added also some inline documentation with an hint about `?nux=1`.
So now we can easily remember how to test this kind of things.

Closes T15844

Test Plan:
In both these pages, you finally see a welcome message, not just in Maniphest:

- http://phorge.localhost/dashboard/panel/?nux=1
- http://phorge.localhost/maniphest/?nux=1

In both these pages, if you have no elements, you finally see a welcome message,
and not just in Maniphest:

- http://phorge.localhost/dashboard/panel/
- http://phorge.localhost/maniphest/

Check that the welcome message helps you in creating a new Panel, and that
talks about Panels, and that have the lovely icon of a Panel.

Reviewers: aklapper, O1 Blessed Committers

Reviewed By: aklapper, O1 Blessed Committers

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15844

Differential Revision: https://we.phorge.it/D25674
2024-06-04 01:45:17 +02:00
Andre Klapper
40720ab83d Expose initially set values of Maniphest custom date field and point values when removing them
Summary:
After removing or resetting a custom date field value or points value initially set at task creation there is no way to find and restore the previous value.
As Phorge adds a transaction entry anyway, include the previous value in the transaction title.
This makes it easier to revert an accidental removal of such data and is also more aligned with the behavior of other custom field types.

Closes T15846

Test Plan:
* Define a custom date field in Maniphest via http://phorge.localhost/config/edit/maniphest.custom-field-definitions/ and also enable http://phorge.localhost/config/edit/maniphest.points/
* Create a task with those fields set to non-custom values via a create task form which allows editing/changing these values
* Edit the task and remove/reset the values of these custom fields
* Look at the task and its transaction entries

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15846

Differential Revision: https://we.phorge.it/D25678
2024-06-03 15:43:27 +02:00
Andre Klapper
1500a57090 Remove unused method shouldCopyWhenCreatingSimilarTask()
Summary:
Nothing in the codebase calls or reads this function.

If it was ever used in some implementation of a custom field, then it was likely in context of the `Similar Task` functionality removed in 52f7446eea.

Test Plan: Grep the codebase.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25677
2024-06-03 15:39:23 +02:00
Andre Klapper
4bf5c452eb Improve error passing task IDs as URL parameter in invalid format
Summary:
Maniphest expects the values of the `ids` URL parameter to be integers. Example: http://phorge.localhost/maniphest/?ids=1,2,3,4 to show a list of tasks with those IDs.
When passing monograms instead (`T` prefix, like `T123` instead of `123`), a cryptic message `Expected a numeric scalar or null for %Ld conversion` is shown.

Thus check if `$this->taskIDs` consists of integers only; if not throw a `PhutilSearchQueryCompilerSyntaxException` with an explanatory error message.

Closes T15838

Test Plan: Go to http://phorge.localhost/maniphest/?ids=T1,T2,T3,T4 before and after applying the patch.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15838

Differential Revision: https://we.phorge.it/D25669
2024-05-29 12:11:10 +02:00
Pppery
3a6e835e36 Fix spelling of etc. in messages per Translatewiki request
Summary: Closes T15839

Test Plan: Read the code and see that it is spelled correctly

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15839

Differential Revision: https://we.phorge.it/D25670
2024-05-25 11:51:48 -04:00
Andre Klapper
c1a8b83bd7 Correct PHPDoc or add default return for numerous methods
Summary:
Correct PHPDoc when none of the method calls try to handle a return value.
Add missing fallback `return` statements (which may never be reached if previous condition checks were always true).

This reduces the amount of errors reported by static code analysis tools.

Test Plan: Carefully read the code and check all places in which a function gets called whether a return value is expected.

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/D25650
2024-05-18 21:54:51 +02:00
Andre Klapper
8c82117878 Fix PonderQuestionCreateMailReceiver accessing non-existing PonderQuestionTransaction constants
Summary:
The transaction types `TYPE_TITLE` and `TYPE_CONTENT` were removed from `PonderQuestionTransaction` in rPdff028c4907dd1959859733ea0d947f244559e7f.
Thus update `PonderQuestionCreateMailReceiver` to use the corresponding modular transactions `PonderQuestionTitleTransaction` and `PonderQuestionContentTransaction` instead.

Test Plan: Carefully read the code, grep the code base, use the test case in D25656#18162.

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/D25656
2024-05-18 21:41:04 +02:00
Valerio Bozzolan
b8a03bc145 Workboard Trigger Rule: allow to Add/Remove Subscribers
Summary:
This is a natural expansion of the Workboard Trigger system
to support actions about Subscribers.

Context: even before this change - Workboard users
were already able to move Tasks to Columns with
nice automatisms. For instance, you can already:

- Play a nice Sound
- Change Task Priority
- Change Task Status
- Add or Remove a Task Owner
- Add or Remove a Task Project Tag

With this change, you can also:

- Add or Remove Task Subscribers

If you need inspiration, this feature is useful for adding
more eyes on a given work area; lighten the notifications
of certain people after certain workflows have already been
done, to increase happiness and mitigate Burnout.

If your goal is to oppress yourself or your coworkers - of
course you can also use this feature to increase the Burnout
of yourself or your coworkers, adding random people as
Subscriber.

Note: every trigger action can be confusing in general, but
it is the fault of Triggers in general and not related to
this specific feature - that is totally loveable,
just like you.

Closes T15162

Test Plan:
- Workboard > Column > Create Trigger
- Add Action > Add Subscriber > (your best friend who hates NodeJS)
- Add Action > Remove Subscriber > (your antagonist who hates PHP)
- Move some Tasks there and here, and note that Add/Remove works

Reviewers: O1 Blessed Committers, Cigaryno, aklapper

Reviewed By: O1 Blessed Committers, Cigaryno, aklapper

Subscribers: aklapper, speck, tobiaswiese, Matthew, Cigaryno

Tags: #workboard

Maniphest Tasks: T15162

Differential Revision: https://we.phorge.it/D25080
2024-05-18 10:15:58 +02:00
Valerio Bozzolan
f4d9d6920b The feed "created this task" should be the first one
Summary:
Create a Maniphest task, Resolved, High priority.

Before this change, this was the feed in the object page:

- a.lincoln closed this task as Resolved.
- a.lincoln triaged this task as High priority.
- a.lincoln __created this task__.

After this change, this is the feed:

- a.lincoln __created this task__.
- a.lincoln closed this task as Resolved.
- a.lincoln triaged this task as High priority.

This also improves the situation in the /feed/ page. So you see the creation now.

Ref T15816

Test Plan:
Create an object in any mentioned application below, setting all fields.

Then, check the history of the object itself. Check also the /feed/ page.
Check that the creation action is now listed first.

This change improves the situation in:

- Maniphest
- Phriction

This change has no impact on these that seem already OK:

- Calendar
- Dashboard
- Dashboard Panel
- Diffusion
- Macro
- Paste
- Ponder
- Project
- Pholio

This change has no impact on these that seem still in the wrong order:

- Differential

The above situation in Differential is noted, but it's unrelated,
since it has a different legacy structure and it deserves more triaging.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15816

Differential Revision: https://we.phorge.it/D25626
2024-05-18 10:05:35 +02:00
Andre Klapper
e6925c83c1 Do not hardcode default Priority names in Project Reports tooltip
Summary:
Pull the names of Priority field values instead of hardcoding them.

Closes T15799

Test Plan:
* As an admin, go to `/config/edit/maniphest.priorities/` and change the value of `"name"` of a Priority value with a value < `50` (e.g.: Low, Wishlist)
* Open `/maniphest/report/project/`
* Hover over the `Oldest (Pri)` column and check the tooltip text before and after applying this patch

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15799

Differential Revision: https://we.phorge.it/D25602
2024-05-17 09:16:10 +02:00
Andre Klapper
d5295da072 Remove deprecated buildStandardPage* method calls
Summary:
Remove deprecated `buildStandardPageView()` and `buildStandardPageResponse()` methods.
They have been deprecated since rP300c74c49dc9d9f3ef1d7bbcc1b2400a3ded0c41 in November 2015.
cf rPd26cca27d70b69080c10e1df92a10419fffbfc7e, rP1b00ef08a039d48adb6bbbcd6956f900b6303b5b.

Test Plan: Compare http://phorge.localhost/xhpast/ before and after; paste and parse some PHP code into http://phorge.localhost/xhpast/; compare resulting http://phorge.localhost/xhpast/view/1/ before and after. Spot no differences and see no errors in DarkConsole.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25634
2024-05-16 08:39:08 +02:00
Andre Klapper
50d0bbe8ff Fix PHP 8.1 "strlen(null)" exception rendering files/documents
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/document/render/PhabricatorDocumentRenderingEngine.php:211]
```

Closes T15826

Test Plan: Surf a Diffusion repository and play with {nav View Options}.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15826

Differential Revision: https://we.phorge.it/D25638
2024-05-15 17:30:58 +02:00
Andre Klapper
464a0aedc4 Fix PHP 8.1 "strlen(null)" exception in PhabricatorAuthStartController.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.

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

Closes T15832

Test Plan: Run `arc unit` locally, probably also don't be logged in.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15832

Differential Revision: https://we.phorge.it/D25639
2024-05-15 14:45:34 +02:00
Aviv Eyal
ea554af476 Add (Advanced) Custom Fields to Item List
Summary:
Allow PHP-coded Custom Fields to show things in Lists.

Also add Repository to Revision List and Flags to Maniphest lists.

Closes T15133. Ref T15512, T15750

Test Plan: Look at Repository List and Task lists that have flags.

Reviewers: O1 Blessed Committers, aklapper, valerio.bozzolan

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

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

Maniphest Tasks: T15750, T15512, T15133

Differential Revision: https://we.phorge.it/D25548
2024-05-11 13:25:41 +03:00
Andre Klapper
f2a01dca39 Fix PHP 8.1 "strlen(null)" exception checking for open setup issues in PhabricatorSetupCheck
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/config/check/PhabricatorSetupCheck.php:125]
```

Closes T15823

Test Plan: Run `./bin/cache purge --all`, check any Phorge page in browser before and after applying this patch.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15823

Differential Revision: https://we.phorge.it/D25633
2024-05-10 18:16:12 +02:00
Valerio Bozzolan
b6f132f04f TransactionEditor: micro-optimize the "creation finder"
Summary:
The foreach starting at old line 1305-1311 was designed to look for a specific transaction type.

When we have found that, let's stop that loop, so, we save some CPU cycles.

Test Plan:
Note that getTransactionType() has not side-effects.

Test some applications - like Pholio - that use the TransactionEditor:

- Create a new Pholio and Save
- Save it again without changes.
- Save it again with changes.

Everything still working normally.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25627
2024-05-09 18:40:50 +02:00
Valerio Bozzolan
6514598f66 Dashboard Text Panel: improve feed when changing Description
Summary:
When creating a Dashboard Text Panel, from example from here:

http://phorge.localhost/dashboard/panel/edit/?panelType=text

After you change its Description,

Before this change, this was the feed (but you must have Developer Mode):

    foo.bar edited this object (transaction type "text.text").

After this change, this is the feed:

    foo.bar edited the the panel text. (Show Details)

So, not only we show a nice title, but we also allow to see details.

| Before     | After      |
|------------|------------|
| {F2182938} | {F2182943} |

Credits:

- LegalpadDocumentTextTransaction for the getTitle() method
- ManiphestTaskDescriptionTransaction for the details

Closes T15817

Test Plan:
- Create a Text Panel from /dashboard/panel/edit/?panelType=text
- Change description
- See the new feed
- Click on "Show Details". Also that works. You see A/B changes.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15817

Differential Revision: https://we.phorge.it/D25625
2024-05-09 18:40:20 +02:00
Andre Klapper
61c953268e Fix PHP 8.1 "strlen(null)" exception rendering Conpherence search results
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/conpherence/query/ConpherenceThreadSearchEngine.php:154]
```

See also similar rPe65ac7b8800d3397abfced7824a8d316ec573d8f

Closes T15818

Test Plan: Go to http://phorge.localhost/conpherence/search/query/all/

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15818

Differential Revision: https://we.phorge.it/D25629
2024-05-09 14:42:13 +02:00
Andre Klapper
aad704d0fc Mark created Pholio mockups as new objects to fix empty Feed transaction entries
Summary:
When creating a Pholio mockup, `setIsCreateTransaction(true)` to avoid an empty `Transaction` field in the Feed and avoid `strncmp()` complaining about a null value being passed.

This is very similar to T15659 about Differential Diffs.

```
ERROR 8192: strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/policy/query/PhabricatorPolicyQuery.php:314]
```

Closes T15679

Test Plan:
1. Create a new Pholio mockup via `/pholio/create/`
2. Go to `/feed/transactions/query/all/`
3. Compare entries in the `Transaction` column before (empty ones) and after (no empty ones) applying the patch.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15679

Differential Revision: https://we.phorge.it/D25600
2024-05-09 11:04:37 +02:00
Perry
29cbb0a658 Make i18n string extraction ignore strings in test case files
Summary:
Do not extract strings from test case files for localization / translation.
They are not exposed to users, and localizing wastes translators' time.

Closes T15815

Test Plan:
* Install Wikimedia downstream `translations` extension via `git clone https://gerrit.wikimedia.org/r/phabricator/translations` and put it on the same filesystem level as `phorge` and `arcanist`, and follow https://we.phorge.it/w/docs/extensions/install/
* Apply https://gerrit.wikimedia.org/r/c/phabricator/translations/+/1028887 on top, to make the `translations` extension work with upstream Phorge.
* In the downstream `translations` extension path, run `./export.sh`, then run `grep -r "__tests__" .` and get a list of `qqq.json` files with context for strings from test files.
* Apply this patch.
* In the downstream `translations` extension path, run `./export.sh`, then run `grep -r "__tests__" .` to verify that no `qqq.json` files include any strings from test files anymore.

Reviewers: O1 Blessed Committers, aklapper, avivey

Reviewed By: O1 Blessed Committers, aklapper, avivey

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

Maniphest Tasks: T15815

Differential Revision: https://we.phorge.it/D25624
2024-05-08 10:58:32 -04:00
Andre Klapper
af300016b6 Fix exception trying to rename user to their previous username
Summary:
When trying to rename a user, properly handle when the new username is the old username to avoid an exception.

```
EXCEPTION: (PhabricatorApplicationTransactionNoEffectException) Transactions have no effect:
  - Transaction (of type "user.rename") has no effect. at [<phorge>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:2823]
```

Closes T15795

Test Plan:
* As an admin, go to `/people/manage/123/` and select `Change Username`. Use the old username as the new username and select `Rename User`. Without the patch, get an exception. With the patch, get a proper error message within the dialog, as if you tried to set the new username to an empty string.
* As an admin, go to `/people/create/`, select `Create Standard User`, and successfully create a new user account.
* In an anonymous browser window, go to `/auth/start/`, click `Register New Account`, and successfully create a new user account.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15795

Differential Revision: https://we.phorge.it/D25601
2024-05-07 16:21:00 +02:00
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
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
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
Valerio Bozzolan
9ebe856219 Update unit test of InterpreterBlockRule for "a {{{a}}}"
Summary:
This is supposed to render in plain text instead of crashing or giving an error, after D25415:

    a {{{a}}}

The related unit test is updated accordingly.

We have unnoticed this, because of the well-known bug T15500.

Ref T15372
See D25415

Test Plan:
This makes sense with the introduced functionality in D25415.

Unit tests are happy again.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15372

Differential Revision: https://we.phorge.it/D25559
2024-03-25 09:28:11 +01:00
Andre Klapper
d42b3eb0b1 Fix "Map omits required key" exception by comparing result order against modern field keys
Summary:
Sorting a Maniphest search query by custom fields throws a "Map returned omits required key" exception.

The `isCustomFieldOrderKey()` check still tested against legacy field key format (for example `[custom:]std:maniphest:deadline.due`) while the code passes modern field key format (for example `custom.deadline.due`).

After fixing this, `PhutilTypeSpec::checkMap()` throws an exception when a non-optional (extra) key `$column` is in `$columns` but not in the array of type parameters below to check against:
`"Got unexpected parameters: customfield, customfield.index.table, customfield.index.key"`
Thus add optional types for customfields in `buildPagingClauseFromMultipleColumns()` to allow them instead of throwing another exception.

Closes T15631

Test Plan:
* Have a custom field (with search: true) defined via http://phorge.localhost/config/edit/maniphest.custom-field-definitions/
* Have two tasks have the custom field set
* Go to http://phorge.localhost/maniphest/query/ , select the custom field (e.g. "Due Date (Reversed)") in the "Order By" field, and click the "Search" button. Iterate through the results via the "Next" button if needed

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15631

Differential Revision: https://we.phorge.it/D25504
2024-03-21 19:25:50 +01:00
Valerio Bozzolan
328aee033f isSelfURI: fix anchors and relative URIs (that are "self" indeed)
Summary:
Example cases that were wrongly considered external URLs:

- "#foo"
- "/foo"

Note that Phorge usually does not change stable things. In fact this thing
was not documented even inline, and was not even in the unit tests.

So this is a fix, and not a breaking change. Probably no one had ever tried it.

Closes T15182

Test Plan:
The already existing unit tests still work.

The added ones make sense.

There are no problems doing other random things.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15182

Differential Revision: https://we.phorge.it/D25555
2024-03-19 17:34:24 +01:00
Valerio Bozzolan
8fe3d68577 Avoid "Action with no effect" for auto-claim statuses after manually removing assignee
Summary:
Sometime you just want to flag something as Resolved and keep that task claimed by nobody.

But, there are some task statuses that can auto-claim, and "Resolved" is one of these.
So, if you "Resolved", Phorge tries to set yourself as claimer.

Keeping that "claimed by nobody" is a bit tricky and also generates a confusing warning.

In fact, after you "Resolved", you can override the defaults with:

- Add Action > Assign / Claim > (nobody)

The problem is, on saving, the above action causes this warning:

> **Action With No Effect**
> One of your actions has no effect:
> The task already has the selected owner.
> Apply remaining actions?
> [ Cancel ] [ Apply Remaining Actions ]

That warning "The task already has the selected owner" really means
"The task is already claimed by nobody" and, indeed, that is exactly what the user wants.

This patch intercepts the above action, and prevents the related confusing "non-effect" warning.

Thanks to hard troubleshooting from user https://we.phorge.it/p/aklapper/

See also https://we.phorge.it/D25476

Closes T15164

Test Plan:
Task 1 open unassigned:

1. Change Status to Resolved
2. Preview yourself as Claimer
3. Add Action > Assign / Claim, and **set <nothing>**
4. Save and, instead of any confusing warning, only the Status changes.

Task 2 open unassigned:

1. Change Status to Resolved
2. Preview yourself as Claimer
3. Add Action > Assign / Claim, keep it as-is
4. Save and, it works as expected (just like before)

Task 3 open unassigned:

1. Change Status to Resolved
2. Preview yourself as Claimer
3. Add Action > Assign / Claim, set to somebody else
4. Save and, it works as expected (just like before)

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15164

Differential Revision: https://we.phorge.it/D25550
2024-03-15 13:50:46 +01:00
David Lawrence
10a3f4fa19 Use predictable filenames when downloading raw diffs from a revision
Summary:
To prevent spammers from abusing this feature on a public server, do not include query parameters in the generated filenames. See <d8bb7d91b7>.

Ref T15665.

Test Plan: Download raw diff from a revision and check filename in URL.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15665

Differential Revision: https://we.phorge.it/D25478

Signed-off-by: Zero King <l2dy@icloud.com>
2024-03-07 00:03:27 +08:00
Andre Klapper
179f866deb Make lipsum project generator also fill in project description
Summary:
`./bin/lipsum` allows to fill up a Phorge instance with bogus data for testing. When creating a project, the code creates a project title, project status, random subscribers/members and picks a random project creator, but does not set a project description.

Make this code also set a project description (which is implemented as a custom field).

Closes T15748

Test Plan:
* On the CLI, use `./bin/lipsum generate projects` to create a bogus project.
* In the web browser, go to `/project/query/all/` and open the project page of the recently created bogus project: See no project description.
* Apply this change.
* On the CLI, use `./bin/lipsum generate projects` to create another bogus project.
* In the web browser, go to `/project/query/all/` and open the project page of the recently created bogus project: See a random project description.

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15748

Differential Revision: https://we.phorge.it/D25545
2024-03-05 12:07:55 +01:00
Merula Turdus
892f527b9f Improve remarkup codeblock syntax highlighting when using Dark Mode
Summary:
PhabricatorDefaultSyntaxStyle works now with 'CSS-color-aliases' instead of fixed colors.

The aliases are translated in the corresponding themes CelerityPostprocessor.

| Before    | After     |
|-----------|-----------|
| {F709419} | {F709421} |

Ref T15056

Test Plan:
1) bin/celerity syntax
2) bin/celerity map
3) bin/cache purge --all
4) sign in
5) go to user's Settings > Display Preferences and select the Accessibility (user interface) "Dark Mode".
6) go to Phriction or Maniphest and add a codeblock.

Example:

``` lang=php
<?php
final class Example extends PhabricatorApplication {
}
```

7) verify that codeblock content is readable
8) also check that with/without this, nothing changes in "normal" theme

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15056

Differential Revision: https://we.phorge.it/D25509
2024-03-03 15:58:03 +01:00
Valerio Bozzolan
bf15a2d98c Trigger: Add Sound "Coin"
Summary:
One preview is better than a thousand of words:

{F270656}

This Sound is probably universally recognized thanks to
videogames like Super Mario® or other popular platforms; but
this specific Coin Sound is not proprietary: it's released
with a Free as in Freedom of Speach license: Creative Commons 0.

As if that were not enough, this Coin sound, instead of
potentially creating frustration like many others - it positively
stimulates part of the human cerebral cortex involved in making
humans more addicted to Phorge. To be precise, this Coin sound is
particularly suitable to be associated with Trigger actions
such as:

- Mark as Resolved
- Move on to the next Milestone
- etc.

But the only limitation here, as usual in Phorge, is
your imagination.

Insert a Coin and have fun with Phorge.

Complete sound credits:

https://freesound.org/people/Jocabundus/sounds/678385/

2023, Jocabundus, Creative Commons Zero (public domain dedication)

This change also introduces a Credits page in Diviner to mentions this
kind of things. Future contributions in that page are encouraged.

Insert a Coin. Play again with Phorge.

Ref T15178
Ref T15248

Test Plan:
- Create a Project with a Workboard
- Create a Column
- Column > Gear > New Trigger...
- Action > Play Sound > "Coin"
- Create a Task on the Backlog column, and drop it on your new Column
- Turn on audio, have fun!

Reviewers: O1 Blessed Committers, Cigaryno, avivey, aklapper

Reviewed By: O1 Blessed Committers, Cigaryno, avivey, aklapper

Subscribers: avivey, aklapper, chris, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15178, T15248

Differential Revision: https://we.phorge.it/D25079
2024-03-03 12:17:48 +01:00
Mukunda Modell
32b5139d46 Diviner: Improve documentation for remarkup code blocks
Summary:
Improve remarkup reference documentation.

* Added a heading for `Code Blocks`
* Added a sentence mentioning the ##```lang## syntax which was added in {T15481}

Test Plan:
* Run `bin/diviner generate` to regen diviner docs.
* Check out the code blocks section of [[/book/phorge/article/remarkup/#code-blocks|Remarkup Reference]]

Reviewers: valerio.bozzolan, O1 Blessed Committers

Reviewed By: valerio.bozzolan, O1 Blessed Committers

Subscribers: tobiaswiese, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25547
2024-03-02 05:32:25 -06:00
Valerio Bozzolan
6df26b98c1 Comments: avoid confusing warning about "core:file"
Summary:
If you are reading this commit message, it probably happened to you this situation:

1. Somebody published a comment that shows the file F123
2. You Submit another comment that shows F123 again

After you click "Submit", a wild warning may appear:

> Post as Comment
> ----
> The action you are taking has no effect:
> Transaction (of type "core:file") has no effect.
> Do you want to post your comment anyway?
> [Undo] [Continue]

In this case you probably contact your favorite Phorge administrator to translate that stuff.
This is an example unofficial translation:

> Post as Comment
> ----
> You mentioned a file. Phorge loves files. Phorge attach files. But somebody else already
> mentioned that file, successfully. So, since Phorge attach Files, Phorge will result in
> doing nothing special, since the file is already perfectly attached by Phorge.
> Phorge will just post your comment.
> Would you like me to just STFU and post your comment?
> [OMG I'm scared] [Post comment and STFU]

After this change you don't see anymore that warning. So it's even rarer in your Pokedex.

Closes T15293

Test Plan:
- Create a comment showing F123 (an existing file)
- Create another comment showing F123
- No wild warnings

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: 20after4, speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15293

Differential Revision: https://we.phorge.it/D25544
2024-02-29 09:17:09 +01:00
Andre Klapper
7cee42ca26 Replace all phurl.io short URIs with target URIs
Summary:
As of February 2024, phurl.io (which is not run by Phorge.it) shows HTTP 503 errors instead of redirecting to the target URIs.

Thus replace any URIs pointing to phurl.io with the corresponding target URIs, based on the mapping listed on https://secure.phabricator.com/phurl/.

Closes T15746

Test Plan: Carefully read the diff.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15746

Differential Revision: https://we.phorge.it/D25543
2024-02-28 14:59:29 +01:00
Andre Klapper
74ec4f7882 Fix typo "pohrge" in "Adding New Classes" documentation
Summary: Fix typo "pohrge" in "Adding New Classes" documentation

Test Plan: Carefully read letter by letter.

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/D25541
2024-02-28 13:52:16 +01:00
Aviv Eyal
8667ed45fa Fix an instance of strlen(null)
Summary: Ref Q112, ref T15064.

Test Plan:
Enter the text `[[hello]]` in a remarkup field - without this change, it causes a deprecation warning in the log.

This doesn't happen if the content looks like a valid URL - this is the "Wiki Link" syntax.

Reviewers: bekay, O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15064

Differential Revision: https://we.phorge.it/D25539
2024-02-23 17:06:26 +02:00
Aviv Eyal
7d8c84a7bd Update PHP versions in install guide: Remove 5, Add 8.
Summary: Ref T15737. Ref T15554. Ref T15064. Ref T15047.

Test Plan: Generate diviner, read section.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15737, T15554, T15064, T15047

Differential Revision: https://we.phorge.it/D25537
2024-02-23 13:35:41 +02:00
Benjamin Kausch
89a5d3132c Implements copy button in clone repo modal
Summary:
This diff adds a copy button to every repo uri in the clone repo modal. I have made the button to select the text to a merely structural span before the input - it just shows the type of the repository uri. When you click inside the input, the entire uri will be selected. Also I have uncluttered the HTML structure. A table is not needed here, nothing a flex block can't handle.

| Before    | After     |
|-----------|-----------|
| {F1360344} | {F1368592} |

While at it, I have extended the used javascript copy behavior. First of all: `document.execCommand('copy')` [[ https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand | could stop working every moment in every browser ]]. The [[ https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Interact_with_the_clipboard | new clipboard API ]] is the way to go, so I have implemented it as the preferred method. The old method is kept as a fallback. And I have added a very nice feature: If defined, the behavior will now issue success or error notifications. See the changed UIExamples for that.

To support the shrinking of JS code with async functions I have patched the JsShrink source.

Test Plan: Go to a repository, hit the clone button and use the new copy button. You will see a shiny notification as a reward.

Reviewers: O1 Blessed Committers, avivey, valerio.bozzolan

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

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

Differential Revision: https://we.phorge.it/D25536
2024-02-15 19:38:39 +01:00
Andre Klapper
e2bec4c1f5 Improve messages when no image formats are supported (due to GD not installed)
Summary:
When GD is not installed, trying to set a custom image for a project/blog/repository/user/etc displays unhelpful error messages (`This server only supports these image formats: .` and `Supported formats: `) due to the array of supported image formats being empty.

Display clearer messages instead.

Closes T15720

Test Plan: Do not have php-gd installed, go to `/project/manage/1/`, take a look at the string below the "Upload Picture" button, select {nav icon=picture, name=Edit Picture} in the sidebar, select `Custom: Choose Icon and Color...`, `Choose Background Color` and `Choose Icon`, then click the `Save Image` button. Also try to upload a custom image and look at the error message.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15720

Differential Revision: https://we.phorge.it/D25525
2024-02-13 17:06:57 +01:00
Andre Klapper
052b5f41c7 Fix PHP 8.1 "strlen(null)" exception rendering dashboard panel with latest tasks when custom int field configured
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/PhabricatorStandardCustomFieldInt.php:56]
```

Closes T15685

Test Plan: After configuring a custom `int` field and a dashboard panel to query and listed the latest created tasks, access the panel and check the PHP error log.

Reviewers: O1 Blessed Committers, speck, valerio.bozzolan

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

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15685

Differential Revision: https://we.phorge.it/D25489
2024-02-12 13:26:19 +01:00
Andre Klapper
821708414e Allow to uninstall (hide) Audit application
Summary:
While many Phorge applications can be uninstalled (such as Differential for pre-merge commit review), this has not been the case for Audit (post-merge commit review) since rP11861265fe94fa97e4d0563c5bdb7b8cac27282d.

In installations which do not use Audit in their workflows, exposing Audit related UI elements creates additional clutter and complexity.

Fixes T15129

Test Plan:
* Go to `/applications/view/PhabricatorAuditApplication/` and click "Uninstall"
* View an individual merged commit in Diffusion, click "Edit Commit" in the sidebar to go to `/diffusion/commit/edit/1/`, see that "Auditors" datasource is not displayed
* View an individual merged commit in Diffusion, click the "Add Action..." dropdown, see that the "Audit Action" section and its entries "Accept Commit" and "Raise Concern" are not displayed
* View an individual merged commit in Diffusion, click the "Add Action..." dropdown, see that the "Change Auditors" entry is not displayed
* Go to `/conduit/` and see that the API method "audit.query" and the entire section "audit" is not displayed
* Go to `/diffusion/commit/` and see no "Active Audits" and "Audited" searches in the left side bar
* Go to `/diffusion/commit/query/all/` and see that no "Auditors" entry is shown for each commit
* Go to `/diffusion/commit/query/all/` and see that no audit related entry is shown in the grey column on the right (if Harbormaster is not installed, there will be no grey column at all)
* Go to `/herald/edit/?content_type=commit&rule_type=global` and see that no Condition entry "Auditors" and no Condition entry "Affected packages that need audit" is displayed
* Go to `/herald/edit/?content_type=commit&rule_type=personal` and see that no "Add me as an auditor" Herald action and no "Added Auditors" Herald condition is displayed

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15129

Differential Revision: https://we.phorge.it/D25503
2024-02-12 12:10:06 +01:00
Mark Jervelund
b445e1d80d Fix config transaction rendering error on auth page by allowing PhutilSafeHTML
Summary: Closes T15706

Test Plan: Checked that the page worked as expected with changes implemented

Reviewers: O1 Blessed Committers, speck, valerio.bozzolan

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

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

Maniphest Tasks: T15706

Differential Revision: https://we.phorge.it/D25512
2024-02-12 11:52:29 +01:00
Jean Guyomarc'h
a7fb04f96c fix PHP 8 "strlen(null)" when moving paths with missing options
Summary:
Running ./bin/repository move-paths without specifying --from nor --to
leads to the PHP 8 error about strlen() not accepting null parameters.

Test Plan: Running ./bin/repository move-paths without --from/--to (shows a proper error)

Reviewers: O1 Blessed Committers, speck, valerio.bozzolan

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

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

Differential Revision: https://we.phorge.it/D25484
2024-02-12 11:05:31 +01:00
Aviv Eyal
f81e821abf Mark manually created Diffs as new objects to fix empty Feed transaction entries
Summary:
When creating a Differential diff manually via `/differential/diff/create/` in the web browser instead of using Arcanist, `setIsCreateTransaction(true)` for the transaction type `DifferentialDiffTransaction::TYPE_DIFF_CREATE` to avoid an empty `Transaction` field in the Feed and avoid `strncmp()` complaining about a null value being passed.

For gory details, see the comments in T15659.

```
ERROR 8192: strncmp(): Passing null to parameter #1 ($string1) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/policy/query/PhabricatorPolicyQuery.php:314]
```

Closes T15659

Test Plan:
1. Create a valid diff via `/differential/diff/create/`
2. Go to `/feed/transactions/query/advanced/` and set `Object Types` to `Differential Diff` and click `Search`
3. See two entries in the `Transaction` column for the just created diff: One says "created this diff", the other one says "created this object with visibility" and is not an empty line anymore which triggered an exception.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

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

Maniphest Tasks: T15659

Differential Revision: https://we.phorge.it/D25517
2024-02-09 11:19:08 +02:00
Andre Klapper
01b5bf9ea1 Deprecate Fund and Phortune prototype applications
Summary: See T15726

Test Plan: Go to `/applications/` and see that Fund and Phortune say "Deprecated".

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Differential Revision: https://we.phorge.it/D25533
2024-02-06 09:16:19 +01:00
Andre Klapper
e3714c86a7 Validate PhabricatorSearchTextField value not to be an array
Summary:
PhabricatorSearchTextField.php's parent class PhabricatorSearchField.php defines an (empty) `protected function validateControlValue($value)`.
Override this function in PhabricatorSearchTextField.php by disallowing arrays (as the only data type which cannot be casted into a text value).

Closes T15714

Test Plan: Apply D25518; then manually edit the code in `ManiphestTaskSearchEngine.php` by defining an array and passing that array to the Page Size text field via `id(new PhabricatorSearchTextField())->setDefaultValue($empty_array)`, then go to `/maniphest/query/advanced/` and see the error message.

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

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

Maniphest Tasks: T15714

Differential Revision: https://we.phorge.it/D25519
2024-02-05 22:41:54 +01:00
Andre Klapper
bb23e86daf Fix PHP 8.1 "json_decode(null)" exception editing a form when custom field of type Users exists
Summary:
When `$value` is `null`, do not pass `$value` down the stack in `buildControl()` to ultimately end up with `json_decode` complaining. Instead, just skip this call.

```
EXCEPTION: (RuntimeException) json_decode(): Passing null to parameter #1 ($json) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=customOAuthUrlencodeNull, ref.master=788098096e11, ref.customOAuthUrlencodeNull=4f0f2043b7e9), phorge(head=customFieldDate, ref.master=bcfcd9acfc12, ref.customFieldDate=ae8cbe84252d)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> json_decode(NULL, boolean) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php:44]
  #2 <#2> PhabricatorStandardCustomFieldPHIDs::setValueFromStorage(NULL) called at [<phorge>/src/infrastructure/customfield/field/PhabricatorCustomField.php:895]
  #3 <#2> PhabricatorCustomField::setValueFromApplicationTransactions(NULL) called at [<phorge>/src/infrastructure/customfield/editor/PhabricatorCustomFieldEditField.php:70]
  #4 <#2> PhabricatorCustomFieldEditField::buildControl() called at [<phorge>/src/applications/transactions/editfield/PhabricatorEditField.php:385]
```

Closes T15602

Test Plan: After applying these three changes and creating a custom field with `"type": "users"` under `/config/edit/maniphest.custom-field-definitions/`, the website `/transactions/editengine/maniphest.task/view/5/` renders correctly in the browser, showing "This is a preview of the current form configuration."

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15602

Differential Revision: https://we.phorge.it/D25390
2024-02-05 16:09:43 +01:00
Andre Klapper
25aebab655 Make misc get*ApplicationClass[Name]() calls return ::class constant instead of string
Summary:
`::class` is available since PHP 5.5 (5.5 is a minimal requirement by Phorge): https://www.php.net/manual/en/language.oop5.basic.php#language.oop5.basic.class.class
It makes finding code using IDEs easier; see discussion in D25500.

Thus replace all string return values with returning the `::class` constant instead, with one exception: 'PhabricatorSettingApplication' in `PhabricatorUserPreferencesSearchEngine.php` does not exist and makes arc lint fail so this string remained unchanged.

Also note that two occurrences were wrapped in `pht()` for reasons I do not know.

List of functions whose return value get updated in this code change:
* getApplicationClassName()
* getAdapterApplicationClass()
* getDatasourceApplicationClass()
* getEditorApplicationClass()
* getEngineApplicationClass()
* getPHIDTypeApplicationClass()
* getQueryApplicationClass()

cf. T15158

Test Plan: Too broad - click around, basically.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15158

Differential Revision: https://we.phorge.it/D25524
2024-02-05 14:11:36 +01:00
Aviv Eyal
d9919ddb06 Revert "Added cross-platform default fonts"
Summary:
Revert rPf8ffa393c4427f8b9026075e6dc490990a12df12 (D25021). This Commit caused more grief then fun.

Ref T15630

Test Plan: Site should still be readable on most platforms

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15630

Differential Revision: https://we.phorge.it/D25530
2024-02-04 23:14:59 +02:00
Andre Klapper
064424c1b7 Add getQueryApplicationClass() to *TransactionQuery.php classes
Summary:
Add `getQueryApplicationClass()` to all `*TransactionQuery.php` classes similar to other `*Query.php` classes having the same function, and make the parent function in `PhabricatorApplicationTransactionQuery.php` abstract.

In the future, this will enable excluding transaction query results based on their underlying application (for example if an application has been uninstalled) to mitigate the problem of overheated search results. See https://we.phorge.it/T15642 for context.

The only callers of `getQueryApplicationClass()` are in `src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php` and `src/applications/policy/__tests__/PhabricatorPolicyTestCase.php`.

See T15642

Test Plan:
Patch changes only one existing code place, thus check if related pages still work as expected:
* Go to http://phorge.localhost/feed/
* Go to http://phorge.localhost/feed/transactions/
* On http://phorge.localhost/feed/transactions/ , click `Edit Query` and set `Object Types` to `Application` etc.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15642

Differential Revision: https://we.phorge.it/D25500
2024-01-28 17:10:46 +01:00
Benjamin Kausch
87db482897 Adds "Locate File" input to every browse directory view in Diffusion
Summary:
Ref T15645

The very helpful "Locate File" input in Diffusion was so far only visible in the homepage route of any repository (`/repository`).

With this revision you can now locate a file from every browsed directory and in any selected commit.

The finder was already "directory sensitive" meaning: if you are trying to locate a file from within a browsed directory, only the children of this path will be searched.

For the searching in a specified commit (for example: https://we.phorge.it/source/phorge/browse/master/src/;05f4d5071fdca02123bd1ff4c0935b847c7f9963), I had to do a little JS magic adding the commit to the URI on the client side.

Test Plan: Checkout, browse through your repos with Diffusion trying to find files. (I tested only with Git repos.)

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15645

Differential Revision: https://we.phorge.it/D25521
2024-01-28 12:51:35 +01:00
Andre Klapper
c0191a0392 Fix PHP 8.1 "strlen(null)" exception creating a Merchant in Phortune
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/phortune/provider/PhortunePaymentProvider.php:99]
```

Closes T15725

Test Plan: See steps in T15725

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15725

Differential Revision: https://we.phorge.it/D25528
2024-01-27 09:20:37 +01:00
Andre Klapper
7a86040f8a Avoid exception setting project profile image when GD not installed
Summary:
When trying to set a custom project profile image while the PHP GD extension is not installed, use the same logic which already exists in `PhabricatorFilesComposeAvatarBuiltinFile.php` to set the default project image. This stills display an unhelpful error message `This server only supports these image formats: .` but avoids an exception trying to call GD's `imagecreatefromstring()`.

```
EXCEPTION: (Error) Call to undefined function imagecreatefromstring() at [<phorge>/src/applications/files/builtin/PhabricatorFilesComposeIconBuiltinFile.php:131]
```

Closes T15326

Test Plan:
1. Remove the php-gd (and potentially gd) packages on your system; restart httpd
2. Go to http://phorge.localhost/project/manage/1/
3. Select `Edit Picture` in the sidebar on the right to go to the `Edit Project Picture` at http://phorge.localhost/project/picture/1/
4. Set a custom icon and color and click the `Save Image` button
5. Get `This server only supports these image formats: .` but no exception anymore

Reviewers: O1 Blessed Committers, avivey, valerio.bozzolan

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

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

Maniphest Tasks: T15326

Differential Revision: https://we.phorge.it/D25515
2024-01-23 15:10:56 +01:00
Andre Klapper
7702772b2b preg_match() null exception setting custom user profile image with empty files.viewable-mime-types
Summary:
When `files.viewable-mime-types` is not set, `getViewableMimeType()` passes `null` to `preg_match()` which is deprecated behavior since PHP 8.1.
Only call `preg_match()` when there are some MIME types to compare.

```
ERROR 8192: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/files/storage/PhabricatorFile.php:974]
```

Closes T15710

Test Plan: Go to a user profile and try to upload a custom profile picture in BMP format.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15710

Differential Revision: https://we.phorge.it/D25516
2024-01-17 16:13:37 +01:00
Valerio Bozzolan
5de10185ce Config User Extra Fields: link to the doc (like Maniphest)
Summary:
Add a documentation link in a specific Config page, that is:

Config > Setting > user.custom-field-definitions

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

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

Visit this page that was the inspirational page:

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

No nuclear implosions.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25507
2024-01-14 15:39:45 +01:00
Valerio Bozzolan
549a26d087 Auth SSH Details: show Public Key (not just Type)
Summary:
At the moment the "SSH Key Details" page lists only two minimal information:

- Key Type (Example: 'ssh-rsa')
- Created  (Example: 'Wed, Dec 13, 5:13 PM')

After this change it shows also the original Public Key. It becomes something like:

- Public Key (Example: 'ssh-rsa AAAB3....... mariana@localhost')
- Created    (Example: 'Wed, Dec 13, 5:13 PM')

This is just a minimal UX change.
Note that you can already see the Public Key by clicking "Edit".
So, nothing new is shown.

Context:

Premising that Phorge encourages to Revoke your decommissioned / deprecated
/ compromised SSH keys with a very lovely "Revoke" Workflow...

Root problem:

If you Revoke one of your keys, and if you then want to double-check that
SSH Public Key again (if you want to see its original body), you then discover
that you cannot see it anymore. In fact, the only way is the Edit button, but
Editing is disabled for any Revoked Key. In this kind of situation, it's not
nice to have to involve your favorite database administrator, to inspect the
'phabricator_auth.auth_sshkey' database table, to just be able to see your SSH
Public Key again.

After this change, you can easily self-audit your Revoked SSH Public Keys,
and your beloved DBA has extra free time. Win-win situation.

Closes T15692

Test Plan:
- visit your SSH Keys, open one, and check the new Details with your big eyes
- do the dame while juggling two ping pong balls (is anybody reading this?)
- do the same on a Revoked key

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15692

Differential Revision: https://we.phorge.it/D25495
2024-01-12 22:34:23 +01:00
Andre Klapper
8e09dbfee3 Fix PHP 8.1 exception creating task when custom select field configured
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.

```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php:14]
```

Closes T15691

Test Plan: After configuring a custom `select` field, try to create a task via a Maniphest form using that custom field.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15691

Differential Revision: https://we.phorge.it/D25494
2024-01-12 08:40:43 +01:00
Andre Klapper
40d10fbe1a Fix PHP 8.1 "strlen(null)" exception when custom select field configured
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/PhabricatorStandardCustomField.php:484]
```

Closes T15687

Test Plan:
Unknown. Definitely requires having custom fields defined, then playing with creating tasks using forms which expose these fields and going to `/maniphest/query/all/`.
See also D25487.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15687

Differential Revision: https://we.phorge.it/D25492
2024-01-12 02:04:50 +01:00
Valerio Bozzolan
6fe942a8f9 Add support for FIDO2-backed SSH keys
Summary:
U2F/FIDO are open standards for inexpensive two-factor authentication hardware that are widely used for website authentication.

These keys are available since OpenSSH 8.2 (2020-02-14).

https://www.openssh.com/txt/release-8.2

https://security.stackexchange.com/q/240991/260234

Ref Q96

Test Plan: Check the added keys. They exactly match the output of the command 'ssh -Q key'.

Reviewers: O1 Blessed Committers, antonia, avivey

Reviewed By: O1 Blessed Committers, antonia, avivey

Subscribers: avivey, tobiaswiese, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25508
2024-01-08 19:07:54 +01:00
Andre Klapper
d92ed9ce0c Hide "Packages" field in Diffusion Commits query form when application uninstalled
Summary: Fixes T15698

Test Plan:
1. Uninstall Packages via `/applications/view/PhabricatorPackagesApplication/`
2. Go to `/diffusion/commit/`, expand the Query form, and see that `Packages` is not shown anymore

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15698

Differential Revision: https://we.phorge.it/D25506
2024-01-06 16:26:01 +01:00
Andre Klapper
428f9686c4 Composing a custom project picture: Remove misaligned empty icon
Summary:
Do not assume that all items under `/resources/builtin/projects/` are image files (some can be subdirectories). Only add PNG files to the map.

Could be nicer to use `is_file()` or `is_dir()` but we are dealing only with string representations of files and folders.

Closes T15696

Test Plan: Go to `/project/picture/1/` and click the `Choose Icon and Color...` button; check last icon shown under "Choose Icon".

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15696

Differential Revision: https://we.phorge.it/D25499
2023-12-27 17:39:28 +01:00
Andre Klapper
2d997c3f10 Avoid "Undefined index" error in project.search API when project_customfieldstorage table has additional fields not requested
Summary:
Do not trigger an "Undefined index" error in PhabricatorCustomFieldStorage when calling the `project.search` Conduit API without passing search parameters when the local project_customfieldstorage table has additional fields configured not requested in the API call.

Closes T15688

Test Plan: See above; `curl -k -s -X GET http://phorge.localhost/api/project.search?api.token=api-xxxxxxxxxxxx | jq -r` for comparison

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

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

Maniphest Tasks: T15688

Differential Revision: https://we.phorge.it/D25493
2023-12-18 12:46:23 +01:00
Kuba Orlik
bd44ec833f Add example systemd unit for sshd in Diffusion docs
Summary:
The docs don't specify how to make the second sshd daemon start on every reboot.

I've added a unit that I use in my setup to the docs.

Ref T15467

Test Plan: Check that the docs look alright.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15467

Differential Revision: https://we.phorge.it/D25497
2023-12-18 10:55:09 +01:00
Kuba Orlik
be763d90ce Fix typo
Summary: This typo appeared in the docs and I thought I'd fix it

Test Plan: See that the typo at src/applications/config/option/PhabricatorCoreConfigOptions.php is gone

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Differential Revision: https://we.phorge.it/D25496
2023-12-18 10:50:35 +01:00
Andre Klapper
fe1122bd4d Catch RuntimeException: mb_convert_encoding(): Illegal character encoding specified at PhabricatorTextDocumentEngine.php:73
Summary:
When given `$encoding` is invalid, catch the exception to show a proper error message and make the server logs provide more hints.

```
EXCEPTION: (RuntimeException) mb_convert_encoding(): Illegal character encoding specified at [<arcanist>/src/error/PhutilErrorHandler.php:261]
#0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer, array) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
#1 <#2> mb_convert_encoding(string, string, string) called at [<phabricator>/src/applications/files/document/PhabricatorTextDocumentEngine.php:73]
```

Closes T15624

Test Plan: Open a URL which passes a bogus encoding value as parameter, like `/source/somerepository/browse/master/README.md?as=source&encode=TROLOLOL`

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15624

Differential Revision: https://we.phorge.it/D25418
2023-12-17 11:42:21 +01:00
Valerio Bozzolan
2295bcda14 Curtain: add Hovercard support
Summary:
Before this change, the right navigation panel (Curtain) had info without Hovercard support.

After this change, all fields, like Subscribers, Tags, Referenced Files etc. have Hovercards.

If you meet an UX problem with a specific field with Hovercard, you can disable that specific
Hovercard, calling PHUICurtainObjectRefView::setHovercarded(false).

This is an example, now with Hovercard support:

{F342785}

Closes T15577

Test Plan:
No nuclear implosions when, on desktop and with a mouse:

Browse Maniphest Task and mouse hover Authored By, Assigned To, Subscribers, Referenced Files, ...

Browse Phriction document and mouse Tags, Referenced Files, Subscribers, ...

Browse single commit and mouse hover Referenced Files, Subscribers, ...

Browse Ponder question and mouse hover Tags, Referenced Files, Subscribers, ...

Browse Differential revision and mouse hover Tags, Referenced Files, Subscribers, ...

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15577

Differential Revision: https://we.phorge.it/D25424
2023-12-10 16:55:14 +01:00
Aviv Eyal
2ba2cbaf9b Show Deprecation Warnings as Setup Warnings
Summary:
Capture Deprecation Warnings, collect them into cache, and show them as a Setup Issue for admins to see and report back to us.

This only captures a sample of the traces, so not to overwhelm users (and RAM. and us) with reports.

Requires D25388. Refs T15554.

Test Plan: Run some flows that are known to bring up Deprecation Warnings. See them as a Setup Issue! Click little triangles to see details.

Reviewers: O1 Blessed Committers, Matthew

Reviewed By: O1 Blessed Committers, Matthew

Subscribers: revi, Sten, tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15554

Differential Revision: https://we.phorge.it/D25440
2023-12-08 17:55:18 +02:00
Waldir Pimenta
c49eeb235e Improve command line prompts in setup issue pages
Summary:
This is a follow-up to D25425, where these improvements to the CLI prompt markers were discussed.

Changes included in this revision:

- Build all prompts the same way
- Remove space after the prompt marker (add it via CSS instead)
- Add server path prefix
- Make the prompt unselectable

Test Plan:
- Visit any of the setup issue pages, e.g. <PHORGE_URL>/config/issue/auth.config-unlocked/ (after ensuring that the corresponding issue is present — in this case, by doing `./bin/auth unlock`)
- For example, Deactivate all PHP extensions to trigger each /config/issue/extension.gd/ etc.
- For example, update at least up to `dc10a7e69ea3` to see the database upgrade tip etc.
- Confirm that the command line prompts now include the path prefix
- Confirm that selecting the command via double-click (or click-and-drag) does not select the prompt

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Tags: #ux, #config

Differential Revision: https://we.phorge.it/D25466
2023-12-07 16:22:24 +00:00
Mukunda Modell
6c8329fb66 Include 'published' date of posts in Phame Atom feeds
Summary:
Metadata of Phame blog posts includes the 'updated' date of a blog post. Make them also include the original 'published' date.

Patch written by @20after4 from:

https://phabricator.wikimedia.org/rPHAB3de500bfc845759d6da82180df0adfc12f973463

Closes T15686

Test Plan:
* Go to the Atom feed of blog 1 at `/phame/blog/feed/1/` and look at this `<feed>`'s source
* Apply patch and do the same, see additional `<published>` entry just like the `<updated>`
* Edit the last blog post in blog 1, then check Atom feed and verify that the published and updated date stamp differ as expected

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15686

Differential Revision: https://we.phorge.it/D25490
2023-12-06 11:34:38 -08:00
Andre Klapper
5ddca7da55 Fix PHP 8.1 "strlen(null)" exception rendering dashboard panel with latest tasks when custom text field configured
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.

```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldText.php:33]
```

Closes T15684

Test Plan: After configuring a custom `text` field and a dashboard panel to query and listed the latest created tasks, access the panel.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15684

Differential Revision: https://we.phorge.it/D25488
2023-12-06 10:32:58 -08:00
Bartosz Dziewoński
c8a9270060 Use user's preferred font for inline code snippets too
Summary:
Use user's preferred font for inline code snippets,
like we already do for block code snippets.

Test Plan:
Set a non-default font in Settings → Display Preferences → Monospaced Font.
Make sure that it applies to both single-tick (inline) and triple-tick (block)
code snippets in comments.

For example, enter:

    42px Tahoma

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15682

Differential Revision: https://we.phorge.it/D25486
2023-12-06 16:50:59 +01:00
Andre Klapper
e610e739cb Fix PHP 8.1 exceptions rendering task when custom select field configured
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.

In the other case, do not call `json_decode()` when passing null to it.

```
EXCEPTION: (RuntimeException) json_decode(): Passing null to parameter #1 ($json) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #1 <#2> json_decode(NULL, boolean) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldPHIDs.php:44]
```

```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/infrastructure/customfield/standard/PhabricatorStandardCustomFieldSelect.php:76]
```

Closes T15683

Test Plan: After configuring a custom `select` field, access a task.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15683

Differential Revision: https://we.phorge.it/D25487
2023-12-05 10:24:17 -08:00
Andre Klapper
acedbd022d Fix exception in Transaction Log after renaming Pholio Mock image: Call to undefined method PholioImageSequenceTransaction::renderHandleLink()
Summary:
Replace call to undefined `renderHandleLink()` with `renderHandle()`.

Additionally, pass `head_key($new)` instead of `key($new)`. This might not be needed strictly speaking for this very issue but should not harm either as several images in a mock can be renamed at once.

```
EXCEPTION: (Error) Call to undefined method PholioImageSequenceTransaction::renderHandleLink() at [<phorge>/src/applications/pholio/xaction/PholioImageSequenceTransaction.php:32]
```

Closes T15680

Test Plan:
* Rename the title of an image in a Pholio mock.
* Go to `/feed/transactions/query/all/` which now renders instead of showing an error, and shows two entries:
* `user renamed an image (newname.jpg) from oldname.jpg to newname.jpg.` and `user updated an image's (newname.jpg) sequence.`
(However, separate T15679 will still show up in the error log after this change.)

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15680

Differential Revision: https://we.phorge.it/D25482
2023-12-04 19:32:01 -08:00
Christopher Speck
99ee9357ef Updates for Mercurial's HTTP protocol
Summary:
While testing https://secure.phabricator.com/D21864 I ran into some issues getting mercurial HTTP access working. Using wireshark I confirmed that my local mercurial 6.4 was not including command arguments as HTTP headers but in the querystring.

I didn't dig too deep into understanding when/why this started happening. The protocol documents this in [[ https://repo.mercurial-scm.org/hg/file/tip/mercurial/helptext/internals/wireprotocol.txt | wireprotocol.txt ]].

>Command arguments can be sent multiple ways. The simplest is part of the URL query string using ``x-www-form-urlencoded`` encoding (see Python's ``urllib.urlencode()``. However, many servers impose length limitations on the URL. So this mechanism is typically only used if the server doesn't support other mechanisms.

Based on that either the mercurial on the server is really old (it's 6.1.1 tho) or maybe some other parsing/info passing in Phab's handling of the wire protocol is causing the client to downgrade the wire protocol support.

Cherry-picked from:

https://secure.phabricator.com/D21867

https://secure.phabricator.com/rP0b6e758978a9691bd5ad25db4aa4c4301640a9a9

Test Plan: Host mercurial repo using HTTP, test push/pull.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25471
2023-11-30 20:16:03 -05:00
Andre Klapper
c3850a3c15 Fix PHP 8.1 "strlen(null)" exception removing custom alt text from image file
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/xaction/PhabricatorFileAltTextTransaction.php:59]
```

Closes T15678

Test Plan: Add and remove alt text on an image file; then go to `/feed/query/all/`

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15678

Differential Revision: https://we.phorge.it/D25481
2023-11-28 14:52:00 +01:00
Matthew Bowker
4d4712b58d Remove Chatlog entirely
Summary:
This commit removes ChatLog entirely.  All of the application files are removed, and the migrations used are stubbed out. I stubbed the migrations as that allows for existing installs to make no changes, but new installs will not create the database.

Fixes T15126

Test Plan: Loaded up http://phorge.local/chatlog and confirmed the 404.  Loaded up http://phorge.local/applications/view/PhabricatorChatLogApplication and confirmed the 404.  Created a new database prefix and ran `bin/storage upgrade` against it, confirmed that the chatlog database was not created.  Restored another prefix (an old one) and ran `bin/storage upgrade` and confirmed database was not deleted.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, tobiaswiese, valerio.bozzolan, Cigaryno

Maniphest Tasks: T15126

Differential Revision: https://we.phorge.it/D25480
2023-11-27 11:38:37 -07:00
bob
cf8d5d60a5 Fix a PHP 8.1 deprecated use of strlen with a NULL argument in commit parser
Summary:
With PHP 8.1+ it is not possible to import a commit if the commiter field is not properly defined
Indeed, if the committer is not properly defined, strlen(null) is called, causing a deprecation warning, elevated to exception.
Using strlen() to check string validity is deprecated since PHP 8.1. Phorge adopts phutil_nonempty_string() as a replacement.

Fix T15629

Test Plan:
- Push a commit to an observed subversion repository
- Import it via the phorge/bin/repository reparse COMMIT_ID --importing
- The commit should be properly imported and available in Diffusion

Reviewers: O1 Blessed Committers, Sten, valerio.bozzolan

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

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

Maniphest Tasks: T15629

Differential Revision: https://we.phorge.it/D25423
2023-11-22 16:56:20 +01:00
bob
acfb44d667 Fix a PHP 8.1 deprecated use of strlen with a NULL argument on commit page
Summary:
With PHP 8.1+ it is not possible to view a commit if the author field is not properly defined
Indeed, if the commit author is not properly defined, strlen(null) is called, causing a deprecation warning, elevated to exception.
Using strlen() to check string validity is deprecated since PHP 8.1. Phorge adopts phutil_nonempty_string() as a replacement.

Fix T15628

Test Plan:
- Push a new commit on a subversion repository (since T15629 is not yet addressed)
- Visualize the commit
- You should not get a RuntimeException

Reviewers: O1 Blessed Committers, Sten, valerio.bozzolan

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

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

Maniphest Tasks: T15628

Differential Revision: https://we.phorge.it/D25422
2023-11-22 16:55:32 +01:00
bob
5bd5266461 Fix a PHP 8.1 deprecated use of strlen with a NULL argument
Summary:
This call prevents users to view a commit in subversion repositories
Indeed, if commiter and/or author field is not properly defined strlen is call with a NULL argument.
Using strlen to check string validity 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.

Fix T15610

Test Plan:
- Sign in (if needed)
- Open a diffusion SVN repository
- Open a commit without user name and or email
- You should be able to view the commit

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15610

Differential Revision: https://we.phorge.it/D25400
2023-11-22 16:54:29 +01:00
Matthew Bowker
1b49165ddd Show more in Application Detail and List view
Summary:
Update the Application Detail view and List View to show a unified set of Badges (Deprecated, etc.), show PHIDs and Monograms on the Application Detail view, allow Applications to register Monograms.

Example of the page /applications/view/PhabricatorDiffusionApplication/:

{F393393}

T15568

Test Plan:
1. Visit /applications/ and see Deprecated badges etc.
2. Visit various Configure buttons from that list and see Monograms, Badges, PHIDs etc.
3. Enjoy screenshots in the comments of this Diff

Reviewers: O1 Blessed Committers, valerio.bozzolan, avivey, speck

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

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

Differential Revision: https://we.phorge.it/D25362
2023-11-21 11:22:23 -07:00
Waldir Pimenta
a741f5d65c Change some instances of "phabricator" to "phorge"
Summary:
Just a small set of replacements in locations that seem innocuous (user-facing messages, documentation, etc.)

Ref T15006

Test Plan:
Nothing should change in terms of behavior. The places where these changes were made should now say "phorge".

Example tests:

- Manage a single User and click on Delete User and see the popup
- Run a test email and check the output
  ./bin/mail send-test --to username
- Visit /maniphest/, shift+click on at least 1 Task, click on Bulk Edit Selected,
  Continue, see the popup
- See the mentioned documentation with your big eyes. Eyes do not explode \o/

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15006

Differential Revision: https://we.phorge.it/D25473
2023-11-18 22:14:15 +00:00
Andre Klapper
05f4d5071f Disallow webcrawlers to index Diffusion commits
Summary:
Phorge already sets `Disallow: /diffusion/` and `Disallow: /source/`.
Thus consequently also disallow accessing specific commits via `/r*`.
See https://secure.phabricator.com/T4610 for previous discussions.

Closes T15670

Test Plan:
Go to `/robots.txt` in the web browser.
Cross fingers that more webcrawlers abide by RFC 9309.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15670

Differential Revision: https://we.phorge.it/D25474
2023-11-17 08:45:30 +01:00
Andre Klapper
76ed0c7ff7 Disallow webcrawlers to follow Paste line number anchor links
Summary:
Paste provides line anchor links in every single line of a paste.
If webcrawlers follow these links, they index the very same Paste again.
Thus disallow in robots.txt to reduce unneeded traffic and indexing time.

Closes T15662

Test Plan:
Go to `/robots.txt` in the web browser.
Cross fingers that more webcrawlers abide by RFC 9309.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15662

Differential Revision: https://we.phorge.it/D25461
2023-11-16 11:00:32 +01:00
Andre Klapper
f42dd5819e Fix possible array to string conversion renaming Pholio Mockup image
Summary:
Premising that the `$old` and `$new` variables are 1-element arrays defined as PHID=>title,
this can cause `renderValue()` repeatedly fail when passing an array instead of its value.

Thus pass `head($old)` instead, to get the first value - that is the only one, even if you rename
multiple images (since this Transaction is about a single Mockup image).

Closes T15646

Test Plan:
* Have `phd` running
* Create a Pholio mockup with at least one image

Edit the Pholio mockup and:

1. rename the Titles of an image
2. rename a single Image
3. rename no image

No nuclear implosions. You still see a lovely Feed mentioning each rename.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15646

Differential Revision: https://we.phorge.it/D25441
2023-11-16 10:42:15 +01:00
Valerio Bozzolan
775d141fe6 Audit Feed: less verbose when the author is the committer
Summary:
If the author and the committer are the same person, do not show them twice.

From:

    UsernameFoo committed <commit hash>: <commit msg> (authored by UsernameFoo).

To:

    UsernameFoo committed <commit hash>: <commit msg>

This only affects the feed.

| Before    | After  |
|-----------|-----------|
| {F342758} | {F342764} |

Closes T15528

Test Plan: Do some mixed commits and visit /feed/query/all/. No nuclear implosions.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15528

Differential Revision: https://we.phorge.it/D25421
2023-11-15 13:57:16 +01:00
Andre Klapper
282e37aaf6 Do not expose Contact Numbers settings panel when no SMS support configured
Summary:
It's useless without SMS support and only exposed to the user themselves.

Closes T15486

Test Plan:
Before and after applying this patch,
* Try to access the list of your contact numbers at `/settings/panel/contact/`
* Try to access an existing, previously created contact number at `/auth/contact/1/`
* Try to add a contact number at `/auth/contact/edit/`
* Go to e.g. `/settings/panel/datetime` and check the "Authentication" section in the left sidebar for {nav icon=hashtag, name=Contact Numbers}

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15486

Differential Revision: https://we.phorge.it/D25452
2023-11-13 14:04:16 +01:00
Zero King
361fcd0cac Initialize static variable to make linter happy
Summary: Uninitialized variable defaults to 0 in this context. Make it explicit.

Test Plan: None. No functional change.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25470
2023-11-13 08:52:00 +08:00
Zero King
4535e8753c Fix typo in DiffusionLowLevelGitRefQuery
Summary: $refs_types is undefined.

Test Plan: None. PhabricatorRepositoryRefCursor::TYPE_REF is not used with DiffusionLowLevelGitRefQuery.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25468
2023-11-13 08:50:41 +08:00
Waldir Pimenta
296ce3956b Fix loop in contribution docs
Summary:
The Contributor Introduction lists in the next steps the Contributing Code page;
in its turn, the Contributing Code page links back to the Contributor Introduction page.

This change fixes that infinite loop by adding an actual path forward, adding a link to the Developer Setup page in the Next Steps section of the Contributing Code page.

Test Plan: Open the /book/contrib/article/contributing_code/ URL and confirm that the Developer Setup is included in the Next Steps section.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Differential Revision: https://we.phorge.it/D25465
2023-11-12 21:07:11 +00:00
Zero King
16d9cc12af Enforce viewable MIME types config on PDF documents
Summary:
Let instance admins decide whether to allow PDFs to be viewable as a Web page. See <5ec132bf9e>.

    MOZILLA: Instead of always allowing PDFs to be viewable in the web UI, [...]
    This checks that the PDF mimetype is viewable according to the system
    configuration.

Ref Q83.

Test Plan:
1. Set `files.viewable-mime-types` to exclude application/pdf.
2. Upload a pdf file.
3. See "No document engine can render the contents of this file." in web UI.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Differential Revision: https://we.phorge.it/D25464
2023-11-13 00:12:50 +08:00
Andre Klapper
5d80b3fd88 Fix PHP 8.1 "strlen(null)" exception rendering PHUISegmentBar without a label
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.

```
EXCEPTION: (RuntimeException) strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [<arcanist>/src/error/PhutilErrorHandler.php:261]
arcanist(head=master, ref.master=df6c315ace5f), phorge(head=master, ref.master=3cc5ee6a33df)
  #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer) called at [<phorge>/src/view/phui/PHUISegmentBarView.php:33]
```

Closes T15622

Test Plan:
After applying this change, page with the PHUISegmentBar without label renders as expected without an exception.

For example, visit this page:

/uiexample/view/PhabricatorAphrontBarUIExample/

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15622

Differential Revision: https://we.phorge.it/D25414
2023-11-12 08:54:23 +01:00
David Lawrence
005fea5a14 Fix view policy inheritance on image transforms
Summary:
Inherit viewPolicy from original image in image transforms and warn about Profile transform making transformed images public. Details:

https://hackerone.com/reports/1984060

8358b435a9

Closes T15663

Test Plan:
1. Click {nav View Transforms} on an image file with restrictive view policy.
2. See (Image will be Public) warning on Profile transform.
3. Click on Workcard transform.
4. Go back to {nav View Transforms} page and visit the Workcard transformed file.
5. Check if its view policy matches the original file.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15663

Differential Revision: https://we.phorge.it/D25462

Signed-off-by: Zero King <l2dy@icloud.com>
2023-11-12 07:09:10 +08:00
Andre Klapper
90f651d669 Add Diffusion policy capability "Can Edit and View Identities"
Summary:
Make it possible not to allow anyone to edit Diffusion identities.
Make it possible not to allow anyone to view other users' email addresses.

Closes T15443

Test Plan:
* As an admin, go to `/applications/view/PhabricatorDiffusionApplication/` and see new policy "Can Edit and View Identities" set to "All Users" (as implicitly before)
* As an admin, go to `/applications/view/PhabricatorDiffusionApplication/` and change "Can Edit and View Identities" from "All Users" to "Administrators"
* As a non-admin, go to `/diffusion/identity/` and try to select the disabled "Create Identity" button; get an error message clicking it due to lack of permissions
* Given there is at least one identity defined, as a non-admin, go directly to `/diffusion/identity/view/1/` and get "You do not have permission to view this object."
* Given there is at least one identity defined, as a non-admin, go directly to `/diffusion/identity/edit/1/` and get "You do not have permission to view this object."
* As a non-admin, go directly to `/diffusion/identity/edit/form/default/` and get "You do not have permission to edit this object."
* As a non-admin, go directly to `/diffusion/identity/` and get "No Identities found." instead of seeing the existing identities listed.
* As an admin, go to `/diffusion/identity/` and still see the existing identities listed.
* As an admin, go to `/diffusion/identity/`, select "Create Identity" to go to `/diffusion/identity/edit/` and see the "Create Identity" page (though broken; see T15453)
* As an admin, go to `/diffusion/identity/view/1/` and still see the existing identity.
* As an admin, go to `/diffusion/identity/edit/1/` and successfully edit the existing identity.

Reviewers: O1 Blessed Committers, speck, valerio.bozzolan

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

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

Maniphest Tasks: T15443

Differential Revision: https://we.phorge.it/D25450
2023-11-11 13:27:11 +01:00
Zero King
c97a50472c Correct default database prefix in documentation
Summary: Default value of `storage.default-namespace` is still `phabricator`. Correct documentation about this.

Test Plan: Compare documentation with src/applications/config/option/PhabricatorMySQLConfigOptions.php.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Differential Revision: https://we.phorge.it/D25463
2023-11-11 10:32:55 +08:00
Andre Klapper
87e9c936ad Make "git cat-file" exception messages include repository monogram/slug
Summary:
When throwing an exception related to output provided by `git cat-file`, include the repository monogram to allow potentially debugging in Git.

Closes T15661

Test Plan:
Unclear. Basically: "have a broken Git repository in Diffusion".
(However this patch changes a message only shown in case of an exception, so in the worst case we'd break the exception via an exception.)

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15661

Differential Revision: https://we.phorge.it/D25460
2023-11-10 11:40:04 +01:00
Waldir Pimenta
0729aa574b Remove mention of Phabricator in the Auth setup check
Summary:
The authentication setup check, available at <PHORGE_URL>/config/issue/auth.config-unlocked/,
contained a reference to Phabricator in the prompt of the command line hint to resolve the issue.
Similar checks only showed the prompt symbol, not the directory, so this one was changed to match.

Ref T15006

Test Plan:
- Run `./bin/auth unlock`
- Visit <PHORGE_URL>/config/issue/auth.config-unlocked/
- Notice that, with this patch, "phabricator" no longer appears in the prompt prefix
  for the suggested fix command at the end of the page.

Reviewers: O1 Blessed Committers, valerio.bozzolan, speck

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

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

Maniphest Tasks: T15006

Differential Revision: https://we.phorge.it/D25425
2023-11-10 09:13:38 +00:00
Waldir Pimenta
8092d90c79 Adjust message in timezone conflict form
Summary:
This applies a suggestion initially proposed in
https://we.phorge.it/D25420#12264

Test Plan:
- Change your browser/system timezone to differ from your Phorge profile timezone
- Click the notice that Phorge shows at the bottom left about the timezone mismatch
- Confirm that the form text has been changed as per the diff in this revision

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/D25458
2023-11-10 09:03:30 +00:00
Valerio Bozzolan
8507d3a950 Fix Exception in Chat room when you are not a Participant
Summary:
After this change you can lurk in public chats, and receive notifications, without crashing your planet.

Fix exception "Undefined index: PHID-USER-..." shown to newcomers when they are receiving messages
from a public Chat they are not members of.

Closes T15497

Test Plan:
- Have the Notification server (Aphlict) enabled and running.
  https://we.phorge.it/book/phorge/article/notifications/
- Be user Alice and visit a Conpherence Room. Alice must be not a participant.
- Be user Bob and send a message in that Room.

Now Alice does not see a crash anymore, but the message from Bob.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15497

Differential Revision: https://we.phorge.it/D25408
2023-11-09 21:05:56 +01:00
Andre Klapper
dfa15726ea Fix cursor paging issue in Given Token query call
Summary:
The "Query" class for Given Token is missing a "withIDs()" method.

`Call to undefined method PhabricatorTokenGivenQuery::withIDs() at [PhabricatorCursorPagedPolicyAwareQuery.php:120]`

Closes T15652

Test Plan: Go to the Token page and pass a URL parameter, such as `/token/given/?after=3`

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15652

Differential Revision: https://we.phorge.it/D25455
2023-11-09 21:01:02 +01:00
Zero King
ce5e0f3e33 Fix doc link to Restarting Phorge
Summary: See Q81. Link to /diviner/find/ could not find the documentation because it was renamed to "Restarting Phorge".

Test Plan:
1. Uninstall optional PHP extension zip and restart Phorge
2. Vist /config/issue/ and click on a missing extension issue
3. Click on the documentation link to Restarting

Reviewers: O1 Blessed Committers, valerio.bozzolan, speck

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

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

Differential Revision: https://we.phorge.it/D25459
2023-11-09 19:33:59 +08:00
roberto.urbani
37ecdf2336 Improving UX for ignoring timezone conflicts
Summary:
When there is a new timezone conflict, you will be able to ignore it with a checkbox.
Fix T15349

Preview:

{F343198}

Test Plan: Having a conflicting timezone, click the notification so the usual popup appears. There is a checkbox, leave it checked to ignore the current conflict, uncheck to manually resolve the conflict by selecting one of the available timezones.

Reviewers: O1 Blessed Committers, valerio.bozzolan, avivey

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

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

Maniphest Tasks: T15349

Differential Revision: https://we.phorge.it/D25420
2023-11-07 09:29:12 +01:00
Andre Klapper
887e344c19 Fix project page 404 after rename and removing new name from alias slugs
Summary:
When renaming a project to a slug already listed under Additional hashtags and explicitly also removing that to-become slug, accessing the project via the URL `/tag/projectname/` returned a 404 until someone added the current project name explicitly under "Additional hashtags" again.

In that case, do not remove the alternative hashtag to avoid the 404.

Closes T15636

Test Plan: See steps in https://we.phorge.it/T15636

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15636

Differential Revision: https://we.phorge.it/D25453
2023-11-05 13:18:15 +01:00
Andre Klapper
222a6fea0a Fix PHP 8.1 "strlen(null)" exception on Diffusion repo URIs page after repo creation
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/repository/storage/PhabricatorRepository.php:348]
```

Closes T15658

Test Plan: Create an empty new Git repository, go to its URIs management page.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15658

Differential Revision: https://we.phorge.it/D25454
2023-11-04 19:35:01 +01:00
Andre Klapper
d4b110af26 Remove unused variable $info in DiffusionCloneController.php
Summary:
Left-over from rPa6b550ba0394284441ee55d11e276a05eb568ad9

Closes T15655

Test Plan: Carefully read the source code file to look out for another appearance; after hours of fruitless searching get slightly disappointed.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15655

Differential Revision: https://we.phorge.it/D25451
2023-10-27 11:34:54 +02:00