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

Allow ProjectQuery to be marked as public #15609

Merged
merged 28 commits into from
May 27, 2024
Merged

Conversation

klaustopher
Copy link
Contributor

@klaustopher klaustopher commented May 19, 2024

This implements the portion of making project lists public.

  • Add DB migration to add a public flag
  • Add public and private scopes to the ProjectQuery model
  • Add a global manage_public_project_queries permission
  • Add a temporary link to the ... menu to change public status of a query
  • Add a section to the projects sidebar, to show all the public queries
  • Change loading of the queries from where(user:) to public.or(private)
  • When a user changes a public query and they do not have the permission to change them offer save as instead of save option
  • Add tests for contract, service, new scopes
  • Add tests for behaviors

It is intended to be a self contained spike that is not relying on the modal or anything, hence why we are temporarily adding the menu items.


Implements https://community.openproject.org/work_packages/55159

@klaustopher klaustopher force-pushed the public-project-lists branch 3 times, most recently from c3775a3 to 5afa381 Compare May 22, 2024 07:00
@klaustopher klaustopher marked this pull request as ready for review May 22, 2024 11:12
app/components/projects/row_component.rb Show resolved Hide resolved
app/components/projects/table_component.rb Show resolved Hide resolved
app/models/queries/projects/project_query.rb Outdated Show resolved Hide resolved
config/initializers/permissions.rb Show resolved Hide resolved
Comment on lines +3 to +4
add_column :project_queries, :public, :boolean, default: false, null: false
add_index :project_queries, :public
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we know if there are instances with enough projects to make this slow (presence of default value) and is it a problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ulferts Can you maybe chime in? I don't think that there are instances where we have too many project queries, that adding a default will slow us down significantly. We can always go ahead and split up the migration and add a background job to add the default value everywhere. But I suppose that this is a non issue.

Also, it seems like Postgres 11 changed the way how new columns with default values are added so it does not change every row in the table, but has a more efficient way to insert.

Copy link
Contributor

@toy toy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just few more nitpicks.
I'm still not convinced about show action, but the rest looks fine, so I leave it up to you

@klaustopher klaustopher merged commit 62d0543 into dev May 27, 2024
10 checks passed
@klaustopher klaustopher deleted the public-project-lists branch May 27, 2024 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants