Merge branch 'develop' into features/file-versioning

This commit is contained in:
Martin Artnik 2024-10-16 13:22:28 +02:00
commit 7804b46937
8 changed files with 24 additions and 12 deletions

View file

@ -1 +1 @@
1.36.2.2
1.37.0

View file

@ -62,7 +62,7 @@ class MyModuleShareableLinksController < ApplicationController
@draw = params[:draw].to_i
per_page = params[:length].to_i < 1 ? Constants::REPOSITORY_DEFAULT_PAGE_SIZE : params[:length].to_i
page = (params[:start].to_i / per_page) + 1
datatable_service = RepositoryDatatableService.new(@repository, params, nil, @my_module, preload_cells: false)
datatable_service = RepositoryDatatableService.new(@repository, params, nil, @my_module, preload_cells: false, disable_reminders: true)
@datatable_params = {
view_mode: params[:view_mode],

View file

@ -57,7 +57,7 @@ class TeamSharedObjectsController < ApplicationController
end
def shareable_teams
teams = current_user.teams.order(:name) - [@model.team]
teams = (Team.order(:name).all - [@model.team]).filter { |t| can_read_team?(t) || @model.private_shared_with?(t) }
render json: teams, each_serializer: ShareableTeamSerializer, model: @model
end

View file

@ -37,14 +37,14 @@
<template v-for="team in shareableTeams">
<div class="col-span-2 flex items-center h-9 gap-1">
<span class="sci-checkbox-container" :class="{'opacity-0 pointer-events-none': sharedWithAllRead}">
<input type="checkbox" class="sci-checkbox" v-model="team.attributes.private_shared_with" />
<input :disabled="!team.attributes.readable" type="checkbox" class="sci-checkbox" v-model="team.attributes.private_shared_with" />
<span class="sci-checkbox-label"></span>
</span>
{{ team.attributes.name }}
{{ team.attributes.name || `(${i18n.t('teams.private_team')})` }}
</div>
<div class="flex justify-center items-center">
<span v-if="team.attributes.private_shared_with"
:class="{'opacity-0 pointer-events-none': sharedWithAllRead}"
:class="{'opacity-0 pointer-events-none': sharedWithAllRead || !team.attributes.readable}"
class="sci-toggle-checkbox-container">
<input type="checkbox"
class="sci-toggle-checkbox"

View file

@ -192,12 +192,13 @@ export default {
}
this.savingLocaiton = true;
const params = {
name: this.object.name,
description: this.object.description,
signed_blob_id: this.object.signed_blob_id,
container: this.object.container
container: this.object.container,
file_name: this.object.file_name || this.attachedImage?.name
};
if (this.object.container) {

View file

@ -2,8 +2,17 @@
class ShareableTeamSerializer < ActiveModel::Serializer
include Rails.application.routes.url_helpers
include Canaid::Helpers::PermissionsHelper
attributes :id, :name, :private_shared_with, :private_shared_with_write
attributes :id, :name, :readable, :private_shared_with, :private_shared_with_write
def name
readable && object.name
end
def readable
can_read_team?(object)
end
def private_shared_with
model.private_shared_with?(object)

View file

@ -13,11 +13,12 @@ class RepositoryDatatableService
PREDEFINED_COLUMNS = %w(row_id row_name added_on added_by archived_on archived_by
assigned relationships updated_on updated_by).freeze
def initialize(repository, params, user, my_module = nil, preload_cells: true)
def initialize(repository, params, user, my_module = nil, preload_cells: true, disable_reminders: false)
@repository = repository
@user = user
@my_module = my_module
@preload_cells = preload_cells
@disable_reminders = disable_reminders
@params = params
@assigned_view = @params[:assigned].in?(%w(assigned assigned_simple))
@sortable_columns = build_sortable_columns
@ -79,7 +80,7 @@ class RepositoryDatatableService
end
end
if Repository.reminders_enabled?
if Repository.reminders_enabled? && !@disable_reminders
repository_rows =
if @repository.archived? || @repository.is_a?(RepositorySnapshot)
# don't load reminders for archived repositories or snapshots

View file

@ -1028,7 +1028,8 @@ en:
guest: "Guest"
normal_user: "Normal user"
admin: "Administrator"
teams:
private_team: "Private team"
user_projects:
view_users:
modal_title: "Members of %{name}"