mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-26 09:42:46 +08:00
Fix sharing settings with invisible teams [SCI-11188]
This commit is contained in:
parent
ca2c409bb0
commit
f388594884
3 changed files with 14 additions and 5 deletions
|
@ -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]
|
||||
render json: teams, each_serializer: ShareableTeamSerializer, model: @model
|
||||
end
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue