Fix reviewers abilities and translated default to true for main language

This commit is contained in:
Simon Prévost 2023-12-21 22:09:41 -05:00
parent 4cd6476e5f
commit 5bbe9ba0ac
4 changed files with 12 additions and 10 deletions

View File

@ -52,6 +52,13 @@ defmodule Accent.RoleAbilities do
hook_update
)a ++ @read_actions
@reviewer_actions ~w(
correct_all_revision
uncorrect_all_revision
correct_translation
uncorrect_translation
)a ++ @any_actions
@developer_actions ~w(
peek_sync
peek_merge
@ -72,7 +79,7 @@ defmodule Accent.RoleAbilities do
delete_project_machine_translations_config
save_project_prompt_config
delete_project_prompt_config
)a ++ @any_actions
)a ++ @reviewer_actions
@admin_actions ~w(
create_slave
@ -88,13 +95,6 @@ defmodule Accent.RoleAbilities do
delete_project
)a ++ @developer_actions
@reviewer_actions ~w(
correct_all_revision
uncorrect_all_revision
correct_translation
uncorrect_translation
)a ++ @any_actions
@actions_with_target ~w(machine_translations_translate use_prompt_improve_text)a
def actions_for(role, target)

View File

@ -7,6 +7,7 @@ defmodule Accent.PreviousTranslation do
corrected_text
conflicted_text
conflicted
translated
removed
value_type
placeholders
@ -30,7 +31,7 @@ defmodule Accent.PreviousTranslation do
iex> Accent.PreviousTranslation.from_translation(nil)
%Accent.PreviousTranslation{}
iex> Accent.PreviousTranslation.from_translation(%Accent.Translation{translated: true, proposed_text: "a", corrected_text: "b", conflicted_text: "c", conflicted: true, removed: false, value_type: "string", placeholders: ["foo"]})
%Accent.PreviousTranslation{translated: false, proposed_text: "a", corrected_text: "b", conflicted_text: "c", conflicted: true, removed: false, value_type: "string", placeholders: ["foo"]}
%Accent.PreviousTranslation{translated: true, proposed_text: "a", corrected_text: "b", conflicted_text: "c", conflicted: true, removed: false, value_type: "string", placeholders: ["foo"]}
"""
def from_translation(nil), do: from_translation(%{})

View File

@ -37,6 +37,7 @@ defmodule Movement.Builders.NewSlave do
plural: translation.plural,
locked: translation.locked,
placeholders: translation.placeholders,
translation_id: translation.id,
options: assigns.new_slave_options,
machine_translations_enabled: machine_translations_enabled
})

View File

@ -57,7 +57,7 @@ defmodule Movement.Migration.Translation do
file_index: operation.file_index,
file_comment: operation.file_comment,
removed: operation.previous_translation && operation.previous_translation.removed,
translated: (operation.previous_translation && operation.previous_translation.translated) || false,
translated: is_nil(operation.translation_id),
revision_id: operation.revision_id,
document_id: operation.document_id,
version_id: operation.version_id,