Skip to content

Commit

Permalink
Fix reviewers abilities and translated default to true for main language
Browse files Browse the repository at this point in the history
  • Loading branch information
simonprev committed Dec 22, 2023
1 parent 4cd6476 commit 5bbe9ba
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
16 changes: 8 additions & 8 deletions lib/accent/auth/role_abilities.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion lib/accent/schemas/previous_translation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ defmodule Accent.PreviousTranslation do
corrected_text
conflicted_text
conflicted
translated
removed
value_type
placeholders
Expand All @@ -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(%{})

Expand Down
1 change: 1 addition & 0 deletions lib/movement/builders/new_slave.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
2 changes: 1 addition & 1 deletion lib/movement/migration/translation.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5bbe9ba

Please sign in to comment.