Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site::current not set in GraphQL #10798

Closed
arcs- opened this issue Sep 13, 2024 · 1 comment
Closed

Site::current not set in GraphQL #10798

arcs- opened this issue Sep 13, 2024 · 1 comment

Comments

@arcs-
Copy link
Contributor

arcs- commented Sep 13, 2024

Bug description

Within Statamic there are various places that use Site::current(), one of which is https://github.com/statamic/cms/blob/5.x/src/Fieldtypes/Bard/LinkMark.php#L69 . This is an issue because Site::current() is not being set when using GraphQL using a site scope (e.g. entry(uri: "/", site: "fr") {}).

In the example of LinkMark this causes the generated link to be from the first site defined and not the requested one.

Would it be an option to set Site::current during the GQL call? While having such a side effect isn't nice, it seems to be the simplest solution.

How to reproduce

  1. Use a multi-site setup (min. two sites) and create a Bard inside a blueprint.
  2. In the second site/language in the Bard define a link to an entry from the second site.
  3. Fetch this entry using GraphQL in the second site.

The surrounding text will be from the correct site but the link will be from the first one

Logs

No response

Environment

Environment
Application Name: XXX
Laravel Version: 11.15.0
PHP Version: 8.3.8
Composer Version: 2.7.7
Environment: local
Debug Mode: ENABLED
URL: XXX
Maintenance Mode: OFF
Timezone: Europe/Zurich
Locale: de

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED

Drivers
Broadcasting: log
Cache: redis
Database: sqlite
Logs: stack / single
Mail: smtp
Queue: redis
Session: redis

Sentry
Enabled: MISSING DSN
Environment: local
Laravel SDK Version: 4.6.1
PHP SDK Version: 4.8.0
Release: 2b96dc5
Sample Rate Errors: 100%
Sample Rate Performance Monitoring: 1%
Sample Rate Profiling: 1%
Send Default PII: ENABLED

Statamic
Addons: 2
Sites: 4 (🇩🇪 Deutsch, 🇫🇷 Français, 🇮🇹 Italiano, 🇬🇧 English)
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.19.0.1 PRO

Installation

Other (please explain)

Additional details

No response

@duncanmcclean
Copy link
Member

Duplicate of #9424.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants