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

17676 commits

Author SHA1 Message Date
Merula Turdus
1f5c54c35a Conduit API: allow phriction.edit to modify viewPolicy and editPolicy
Summary: Closes T15858

Test Plan: See T15858

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15858

Differential Revision: https://we.phorge.it/D25693
2024-06-21 18:10:30 +02:00
Aviv Eyal
587530a9bf Add Standard Custom Fields to Item List
Summary:
Allow "Standard" (config-based") custom fields to be displayed in search-results.

Depends on D25548. Ref T15750.

Test Plan: Set `maniphest.custom-field-definitions` to the value of P32, and start playing with custom values on tasks.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15750

Differential Revision: https://we.phorge.it/D25549
2024-06-21 12:43:18 +03:00
Andre Klapper
5d479556c3 Display same items in mobile menu on User Profile page as on desktop
Summary:
Display same items in mobile menu on User Profile page as on desktop. (The code did not make too much sense anyway here?)

Also remove special but dysfunctional "Calendar" item in mobile view: The resulting URI does not work even if the calendar application is installed. If it ever worked, it should be moved to the default desktop sidebar anyway and not be a mobile-only menu item.

Closes T15224

Test Plan: Open http://phorge.localhost/people/ and http://phorge.localhost/p/username and http://phorge.localhost/people/manage/1/, change screen width to less and more than 920px, check at menu items in left bar (>920px) and right upper corner (<920px).

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15224

Differential Revision: https://we.phorge.it/D25687
2024-06-18 20:00:53 +02:00
Merula Turdus
000bccf8e4 Fix PHP 8.1 "strlen(null)" exception in PhabricatorMailSMTPAdapter when sending email
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.

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/htdocs/phorge/phorge/src/applications/metamta/adapter/PhabricatorMailSMTPAdapter.php:65]
```

Closes T15857

Test Plan: Send Welcome email via 'Manage' user screen and Run `./bin/phd log` afterwards to validate email action

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15857

Differential Revision: https://we.phorge.it/D25692
2024-06-15 15:14:40 +02:00
Pppery
1bb7422662 Reword joke password reset email message
Summary: Closes T15840

Test Plan: Send an I forgot my password email with serious business mode off and see the updated email

Reviewers: O1 Blessed Committers, valerio.bozzolan, aklapper

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

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

Maniphest Tasks: T15840

Differential Revision: https://we.phorge.it/D25671
2024-06-11 23:59:44 -04:00
Andre Klapper
8f36181073 Fix PHP 8.1 "strlen(null)" exception in Diviner when PHPDoc has no @task block
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/diviner/controller/DivinerAtomController.php:440]
```

Closes T15853

Test Plan: Run `./bin/diviner generate` and visit a Diviner page about a class which has no PHPDoc `@task` block, for example access http://phorge.localhost/diviner/find/?name=PhutilSafeHTML&type=class&jump=1

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

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

Maniphest Tasks: T15853

Differential Revision: https://we.phorge.it/D25689
2024-06-11 22:52:12 +02:00
Merula Turdus
214988fafd T15774: Celerity: javascript minification issue with template literals (backticked strings)
Test Plan:
This archive contains a small demo: {F2142567}
When installed, an application named D25571 appears under "More Applications".
When you start it, you will see 2 messageboxes: one should be a single lined text, the other a multilined text.

Steps:
1) unpack archive in some directory
2) add ext-D25571/src/ path to load-libraries in local.json
3) bin/arc liberate
4) bin/cache purge --all
5) bin/celerity map
6) restart httpd
7) start D25571 application from More Applications

Also:

    arc unit ./src/applications/celerity/__tests__/CelerityResourceTransformerTestCase.php

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

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

Maniphest Tasks: T15774

Differential Revision: https://we.phorge.it/D25571
2024-06-11 17:09:47 +02:00
Andre Klapper
c1d86da5b2 Initialize $cache_key variable in CelerityResourceController.php
Summary:
`$cache_key` is unconditionally called in `$cache->setKey($cache_key, $data)` but is only defined if the previous condition `if ($is_cacheable && $is_locally_cacheable && !$dev_mode)` was true.
Thus initialize the variable to avoid a theoretical exception. (No additional null check is needed as `$cache` gets defined in the same condition.)

Test Plan: Carefully read the code.

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/D25642
2024-06-11 13:54:58 +02:00
Andre Klapper
10cb252163 Fix PHP 8.1 exceptions importing ICS file without attendee names
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.

Passing `null` to `preg_match()` is deprecated behavior since PHP 8.1.
Thus only call `preg_match()` when the value is set.

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: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/calendar/import/PhabricatorCalendarImportEngine.php:238]
```

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/calendar/import/PhabricatorCalendarImportEngine.php:245]
```

Closes T15852

Test Plan: Import an ICS file which lists attendees without a name but only with an email address into the calendar via http://phorge.localhost/calendar/import/ > "Import Events" > "Import .ics File"

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15852

Differential Revision: https://we.phorge.it/D25686
2024-06-11 00:54:38 +02:00
Andre Klapper
a83ba95445 Only display "Calendar" entry in user profile page menu on mobile when Calendar application is installed
Summary:
https://we.phorge.it/source/phorge/browse/master/src/view/page/PhabricatorStandardPageView.php$908 tries to "find some navigational menu items to create a mobile navigation menu from" but does not succeed too much it seems:
On a user profile page, that very code calls `buildApplicationMenu()` in `PhabricatorPeopleController` which calls `buildSideNavView()` in the same class.
This code unconditionally displays a "Calendar" menu item, no matter if the Calendar application is installed or not. Thus check first to avoid offering a link ending up in a 404.

For the time being this change renders the menu empty (apart from a link to the page we are already on) but that's more acceptable than all those tears shed by devastated users after clicking the Calendar menu item while being excited and full of anticipation, just to end up on a 404 page instead.

Related: T15224

Test Plan:
* As an admin, install/uninstall Calendar prototype application via http://phorge.localhost/applications/view/PhabricatorCalendarApplication/
* Go to a user profile page like http://phorge.localhost/username/ on a screen with 920px or less width and click the hamburger menu item in the upper right corner. Check/click the "Calendar" entry.

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/D25683
2024-06-08 10:02:07 +02:00
Andre Klapper
d2bca2f32d Fix call to non-existing getTransactionCommentForSave() in PhabricatorInlineComment
Summary:
rPb48a22bf50a32895566e9aa66c1d7aff87a492b8 moved the call `$this->getTransactionCommentForSave()->save()` from within `PhabricatorAuditInlineComment` to the new (parent) class `PhabricatorInlineComment.php`, however the later does not define this function.

As the two child classes which extend `PhabricatorInlineComment` both implement `getTransactionCommentForSave()`, declare an abstract function in their parent class.

Test Plan: Carefully read the code.

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/D25644
2024-06-07 19:28:31 +02:00
Andre Klapper
17b568b94f Fix PHP 8.1 "strlen(null)" exceptions editing existing Dashboard query panel with no query 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/dashboard/editfield/PhabricatorDashboardQueryPanelQueryEditField.php:41]
```

```
ERROR 8192: strlen(): Passing null to parameter #1 ($string) of type string is deprecated at [/var/www/html/phorge/phorge/src/applications/dashboard/editfield/PhabricatorDashboardQueryPanelQueryEditField.php:59]
```

Closes T15791

Test Plan: Successfully create a Dashboard query panel searching for "Diffusion Raw Commits" (which has no Query defined per T15790) and try to edit it afterwards under PHP 8.1 or later.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15791

Differential Revision: https://we.phorge.it/D25596
2024-06-07 13:32:33 +02:00
Andre Klapper
3349c3be17 Fix call to non-existing newWorkCommands() in NuanceItemType
Summary:
rPe1b8532e2478395bd1f36baecb998adeef5bea3d introduced an implementation of `newWorkCommands()` in the child class `NuanceFormItemType` which is called in parent `NuanceItemType::buildWorkCommands()` without being defined in that parent class.
Thus define `newWorkCommands()` as an abstract class in parent class `NuanceItemType` and add an implementation returning null in the other child class `NuanceGitHubEventItemType` to make static code analyzers happy.

Test Plan: Carefully read the code.

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/D25655
2024-06-07 13:30:49 +02:00
Andre Klapper
cb5a72b5e6 Fix call to non-existing getDisplayName() in DiffusionRepositoryClusterEngine.php
Summary:
`DiffusionRepositoryClusterEngine` calls `$this->getDisplayName()` which is not defined in this class or its parent class.
Looking at the variable use in the companying error message, getting the name of the `$repository` was intended instead.

Test Plan: Carefully read the code and check available methods in its parent classes.

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/D25653
2024-06-07 13:30:15 +02:00
Pppery
d8cd959622 Fix a leftover misspelled "Phabricator" reference
Summary: Closes T15850

Test Plan: Read the code and see that there isn't a typo anymore

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

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

Maniphest Tasks: T15850

Differential Revision: https://we.phorge.it/D25682
2024-06-06 10:36:51 -04:00
Andre Klapper
cb934602c2 Fix PHP 8.1 "strlen(null)" exception creating a Portal
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/dashboard/menuitem/PhabricatorDashboardPortalMenuItem.php:34]
```

Closes T15847

Test Plan: Go to `/portal/edit/form/default/`, set a name and click `Create Portal`.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15847

Differential Revision: https://we.phorge.it/D25681
2024-06-05 17:18:17 +02:00
Andre Klapper
5f565e2ab6 Correct PHPDoc return value for loadObject() in PhabricatorObjectMailReceiver
Summary:
The PHPDoc for the abstract function `loadObject()` defines `@return void`, however the function's return value is used twice in `PhabricatorObjectMailReceiver` and all 17 `loadObject()` implementations in child classes return an object provided by some type of `PhabricatorCursorPagedPolicyAwareQuery`.
Thus correct the PHPDoc to make static code analyzers happier.

Test Plan: Carefully read and compare the code.

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/D25654
2024-06-05 17:17:35 +02:00
Andre Klapper
98884f758a Fix call to non-existing newIcons() in PhabricatorIconSet
Summary:
`PhabricatorIconSet::getIcons()` calls `$this->newIcons()` which is undefined.

As all six child classes which extend `PhabricatorIconSet` implement `newIcons()`, declare an abstract function in their parent class.

Test Plan: Carefully read the code.

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/D25647
2024-06-05 17:15:45 +02:00
Andre Klapper
a8af0c6e51 Remove unused variable from HeraldEngine
Summary: `$activeRule` is not used anywhere.

Test Plan: Grep the code.

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/D25679
2024-06-05 10:30:05 +02:00
Pppery
8dd90edd3a Remove broken link to PhutilHighIntensityIntervalDaemon docs
Summary: Closes T15845

Test Plan: Read the code - this changes nothing other than comments

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

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

Maniphest Tasks: T15845

Differential Revision: https://we.phorge.it/D25680
2024-06-04 17:31:38 -04:00
Valerio Bozzolan
5a40739451 Show login page if a search token requires a valid viewer
Summary:
A saved query can have tokens that require a valid current viewer. For example, this token:

    viewer()

Before this change, visiting such saved queries would cause this:

    This datasource ("PhabricatorPeopleUserFunctionDatasource") can not evaluate the function "viewer(...)".

After this change, instead of that, you are just redirected to the login page,
so, after you do the login, you are redirected back to that saved query and it works.

This fix was boosted during the Wikimedia Hackaton (wmhack) in Tallinn. Thanks Tallinn!

https://phabricator.wikimedia.org/T356384

Fixes T15704

Test Plan:
Go to Maniphest > Advanced Search > Assigned to > "Viewer". It still works.

Visit the same page in a new anonymous tab: now it redirects to the login page. You login,
and that page works again.

Do the same specific test for all these cases:

- Maniphest
    - Assigned To: viewer
    - Tags: current Viewer's Projects
    - Authors: viewer
    - Subscribers: ...
    - Closed by
- Badges
    - Subscribers
- Differential
    - Responsible Users
    - Authors
    - Reviewers
    - Subscribers
    - Tags
- Dashboards
    - Authored By
    - Tags
- Dashboard Panels
    - Authored By
- Dashboard Portals
    - Tags
- Calendar:
    - Hosts
    - Invited
    - Subscribers
    - Tags
- Countdown
    - Authors
- Diffusion
    - Tags
    - Subscribers
    - Tags
- Diffusion commit
    - Responsible Users
    - Authors
    - Subscribers
    - Tags
- Diffusion identities
    - Matching Users
- Feed
    - Include Users
    - Include Projects (interestingly it does not support "current Viewer's Projects")
- Files
    - Authors
- Herald
    - Authors
    - Subscribers
- Legalpad
    - Subscribers
- Nuance (none of their entity support search by token)
- Passphrase
    - Subscribers
- Paste
    - Authors
    - Subscribers
    - Tags
- Phame
    - Subscribers
    - Tags
- Pholio
    - Authors
    - Subscribers
    - Tags
- Phrequent
    - Users (interestingly it does not support "viewer")
- Ponder
    - Authors
    - Answered By
- Projects
    - Members
    - Watchers
- Transactions - /feed/transactions/
    - Authors
- General search at /search/query/
    - Authors
    - Owners
    - Subscribers
    - Tags

All the above fields were tested in a clean search, one at a time, both logged-in and logged-out, with the function "viewer" or anything similar like "current Viewer's Projects":

For all cases, the login page appeared successfully where needed, instead of a crash.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, avivey, tobiaswiese, Matthew, Cigaryno

Maniphest Tasks: T15704

Differential Revision: https://we.phorge.it/D25621
2024-06-04 16:10:50 +02:00
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
d9e543ba97 PHPMailer: Set defaults for required parameters followed by optional parameters in Authorise() method signature
Summary:
Required parameters $password and $username follow the optional parameter $tval.
This is deprecated since PHP 8.0 per https://www.php.net/manual/en/migration80.deprecated.php
Define defaults for those required parameters to fix the issue - https://github.com/PHPMailer/PHPMailer/blob/master/src/POP3.php#L199 seems to also have survived so far without complaints by PHP 8 users (and PHPStan also does not complain anymore after this change).

Closes T15834

Test Plan: Carefully read the code.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15834

Differential Revision: https://we.phorge.it/D25660
2024-05-30 15:40:35 +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
Andre Klapper
40b1e6b17a PHPMailer: Remove unused variable
Summary: `$tmp` is declared but never used.

Test Plan: Read/grep the code.

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/D25665
2024-05-28 08:35:47 +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
67c0efdffb PHPMailer: Remove duplicate array keys
Summary:
`'doc'` is listed twice in the `$mimes` array. Remove one key.

The second key was also removed in 6f919df65e.

Test Plan: Read/grep the code.

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25666
2024-05-21 11:07:39 +02:00
Andre Klapper
a579a974eb PHPMailer: Remove use of each() function removed in PHP 8.0
Summary:
`each()` has been deprecated since PHP 7.2 and got removed in PHP 8.0 per https://www.php.net/manual/en/function.each.php

Replace it with a `foreach` construction.

Closes T15833

Test Plan: Carefully read the code; locally testing that construction per D25659#18155; compare to similar rP9623e667458821f696eb92e9dac5a2c9720af7af

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15833

Differential Revision: https://we.phorge.it/D25659
2024-05-19 13:10:12 +02:00
Andre Klapper
601ac45032 PHPMailer: Remove check for non-existing get_magic_quotes()
Summary: No idea if PHP ever offered such a method. In any case, this very check was removed in 6f919df65e (diff-2d294eae28fb0d70fc32da8369c4fe33d301c99ca3eeb4bd41da18ad99344d68) in 2012.

Test Plan: Not sure - how to test a removed check for a method which does not exist anyway? :)

Reviewers: O1 Blessed Committers, avivey

Reviewed By: O1 Blessed Committers, avivey

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25663
2024-05-19 10:20:00 +02: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
23a3f59be2 Fix typo creating QRbitstream()
Summary:
Make the one `new QRbitrtream()` look like the other nine `new QRbitstream()`.

Interestingly, this bug was reported upstream since 2018, and still not fixed:

https://github.com/t0k4rt/phpqrcode/issues/47

Test Plan:
Read the code aloud and realize that this word sound weird.

Verify that the class `QRbitrtream` does not exist, and `QRbitstream` exists.

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/D25651
2024-05-18 21:45:09 +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
a6499aee0e PHPMailer: Remove a check for PHP 5.0
Summary:
Phorge requires PHP 5.5, thus remove a version check for PHP 5.0.
Compare the same code in https://github.com/PHPMailer/PHPMailer/blob/master/src/POP3.php#L282-L283

Test Plan: Carefully read the code.

Reviewers: O1 Blessed Committers, speck

Reviewed By: O1 Blessed Committers, speck

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Differential Revision: https://we.phorge.it/D25661
2024-05-18 02:00:28 +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
Andre Klapper
8a3b70aa7d Run ./bin/celerity map after previous commit
Summary: Followup to rP67b7181f522673b05435083ce28106bdfa320e18

Test Plan: Run `./bin/celerity map` and see changes due to my previous commit.

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/D25637
2024-05-13 19:00:03 +02:00
Andre Klapper
67b7181f52 Facts: Always render YYYY-MM-DD dates with eight digits in chart tooltips
Summary:
Always render dates in tooltips when hovering over data points in Burndown charts etc of the Facts application as `YYYY-MM-DD` instead of `YYYY-M-D` by converting the integer to a string and if its length is only one character, prepend a zero.

Closes T15819

Test Plan:
* Enable the Facts application, go to the Reports of a Project with task changes over time, hover over data points and read the tooltip.
* Check Console of web browser's developer tools for no errors.

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15819

Differential Revision: https://we.phorge.it/D25630
2024-05-12 10:19:25 +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
Valerio Bozzolan
5b90567f64 Persistent Chat: fix de-minimize misclick
Summary:
When the persistent chat is minimized to the bottom of your window, as mentioned in T15626,
the chat bar still has an invisible square area that does nothing if you click it by mistake:

{F2184778}

That area was reserved for the Settings Icon, that appears only if you de-minimize the chat.

The Settings Icon was toggled incorrectly from CSS. It was just hiding the Font Awesome icon,
(.fa-gear), instead of hiding its clickable container.

After this change, chat can be de-minimized even if you click in that specific evil spot.

Original credit to @roberto.urbani for the original troubleshooting and original patch.

Follow-up from: D25428

Closes T15626

Test Plan:
Show the Chat, then:

- when the chat is de-collapsed:
    - you see the Settings icon (as before)
    - you can click on the Settings Icon (as before)
    - it shows the Settings menu (as before)
- when the chat is collapsed:
    - you can click in whatever point, and it de-collapse (better than before)

Additionally, use the HTML inspector in your browser (`F12` from Firefox),
to double-check that now that `<li>` has display: none when the chat is collapsed.

Reviewers: O1 Blessed Committers, aklapper

Reviewed By: O1 Blessed Committers, aklapper

Subscribers: aklapper, tobiaswiese, Matthew, Cigaryno, roberto.urbani

Maniphest Tasks: T15626

Differential Revision: https://we.phorge.it/D25628
2024-05-09 13:56:18 +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