1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-09-19 00:38:51 +02:00
Commit graph

17486 commits

Author SHA1 Message Date
Andre Klapper
644f179dd2 Make incoming mail handling more robust / correct
Summary:
* Properly handle when no mail headers at all can be parsed
* Properly handle when mail headers can be parsed but no subject line can be found

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

Closes T15769

Test Plan: See T15769

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15769

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

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

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

Closes T15770

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

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15770

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

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

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

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

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

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

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

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

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

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

Fixes T15728

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

Reviewers: O1 Blessed Committers, avivey, valerio.bozzolan

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

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

Maniphest Tasks: T15728

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

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

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

Closes T15761

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

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15761

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

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

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

Closes T15765

Test Plan: See T15765

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15765

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

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

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

Closes T15767

Test Plan: See T15767

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15767

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

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

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

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

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

Closes T15752

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

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

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

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

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

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

Subscribers: tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15752

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

Config > Setting > projects.custom-field-definitions

Comparison example:

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

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

https://we.phorge.it/D25507

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

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

Visit this page that was the inspirational page:

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

Check that no nuclear implosion is raised.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno

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

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

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

Reviewers: aklapper, O1 Blessed Committers

Reviewed By: aklapper, O1 Blessed Committers

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15762

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

Closes T15729

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

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: avivey, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15729

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

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

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

You are affected by this crash after this commit:

328aee033f

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

In short:

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

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

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

Closes T15763

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

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

Reviewers: zhe, avivey, O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: speck, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15763

Differential Revision: https://we.phorge.it/D25561
2024-03-26 07:30:10 +01:00
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
Valerio Bozzolan
faf43d7edf Celerity map late update
Summary:
This change is probably needed after 892f527b9f.
At that time, the unit test was successfully completed probably because of a lack
of git rebase master.

Test Plan: The unit test PhabricatorCelerityTestCase::testCelerityMaps is not screaming.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25553
2024-03-07 11:29:25 +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
Aviv Eyal
9c9fbc3d04 unbreak celerity/map
Test Plan: phorge will load and serve pages

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

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

Differential Revision: https://we.phorge.it/D25532
2024-02-05 20:08:09 +02: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
Benjamin Kausch
f8db94f2bf Add flexible line height to remarkup headers
Summary:
The text in remarkup has a fixed line height. The headers will have the same fixed line height, even if their font size can be bigger than this line height. Especially on mobile this results in ugly sticked together lines which are less readable.

This revision will give the header a flexible line height of `1.3`. Unitless means relative to the font size.

| Before    | After     |
|-----------|-----------|
| {F717418} | {F717419} |

(I have moved the same margin attribute for every `h{2-6}` into the new declaration.)

Close T15716.

Test Plan: Just checkout and look in wiki articles with headers to see if everything looks nice and neat.

Reviewers: O1 Blessed Committers, 20after4

Reviewed By: O1 Blessed Committers, 20after4

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

Maniphest Tasks: T15716

Differential Revision: https://we.phorge.it/D25523
2024-01-28 12:45:04 +01:00
Andre Klapper
6a30dc039e Update external timezone information
Summary:
Update the list of timezones from 2016 by pulling from CLDR upstream (revision `57c1f4c` from 2024-01-11) located at https://github.com/unicode-org/cldr/blob/main/common/supplemental/windowsZones.xml

Closes T15727

Test Plan:
* As an admin, go to http://phorge.localhost/config/edit/phabricator.timezone/ and change the default value.
* As a user, go to http://phorge.localhost/settings/panel/datetime/ and change the value in the `Timezone` dropdown.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15727

Differential Revision: https://we.phorge.it/D25529
2024-01-27 13:29:02 +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
Benjamin Kausch
b035743ce3 Show title entirely and cut of secondary information gracefully in typeahead results of main search
Summary:
This revision increases the usability of the typeahead results of the main search (on the right in the top bar).
The result texts wont't overflow in a reasonable way.

| Before    | After     |
|-----------|-----------|
| {F715296} | {F715385} |

The result title (red box) will now break so the user can read and understand it.
The result type (blue box) will be cut off inside the padding with an ellipsis.

See T15715

Test Plan:
Check it out and use the main search in the top bar to create typeahead result with very long titles ;)

Nothing changes for short titles.

Reviewers: O1 Blessed Committers, valerio.bozzolan, avivey

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

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

Maniphest Tasks: T15715

Differential Revision: https://we.phorge.it/D25520
2024-01-22 17:35:27 +01:00
Benjamin Kausch
2f1e271c5f Remove bottom margin from embedded remarkup images
Summary:
{T15473} created a very small but annoying regression. Every embedded images has now an margin at the bottom:

{F718091}

I don't think this is intentional. If you click on the margin the image itself is opened not the lightbox. This revision removes the margin.

Test Plan: Look at tasks with embedded images and see if there is still an margin.

Reviewers: O1 Blessed Committers, valerio.bozzolan, aklapper

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

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

Differential Revision: https://we.phorge.it/D25522
2024-01-22 17:06:16 +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