Skip to content

Commit

Permalink
Merge pull request #6258 from CitizenLabDotCo/master
Browse files Browse the repository at this point in the history
Release 2023-10-27
  • Loading branch information
sebastienhoorens authored Oct 27, 2023
2 parents 58310ba + 24c689b commit 00218eb
Show file tree
Hide file tree
Showing 10 changed files with 90 additions and 128 deletions.
2 changes: 1 addition & 1 deletion back/app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def reset_confirmation_and_counts
end

def should_send_confirmation_email?
confirmation_required? && email_confirmation_code_sent_at.nil?
confirmation_required? && email_confirmation_code_sent_at.nil? && (PhoneService.new.encoded_phone_or_email?(email) == :email)
end

def email_confirmation_code_expiration_at
Expand Down
4 changes: 2 additions & 2 deletions back/app/services/side_fx_user_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def after_create(user, current_user)
LogActivityJob.set(wait: 5.seconds).perform_later(user, 'admin_rights_given', current_user, user.created_at.to_i)
end
user.create_email_campaigns_unsubscription_token
RequestConfirmationCodeJob.perform_later(user) if user.should_send_confirmation_email?
RequestConfirmationCodeJob.perform_now(user) if user.should_send_confirmation_email?
AdditionalSeatsIncrementer.increment_if_necessary(user, current_user) if user.roles_previously_changed?
end

Expand All @@ -29,7 +29,7 @@ def after_update(user, current_user)
AdditionalSeatsIncrementer.increment_if_necessary(user, current_user) if user.roles_previously_changed?

UpdateMemberCountJob.perform_later
RequestConfirmationCodeJob.perform_later(user) if user.should_send_confirmation_email?
RequestConfirmationCodeJob.perform_now(user) if user.should_send_confirmation_email?
end

def before_destroy(user, _current_user)
Expand Down
14 changes: 7 additions & 7 deletions back/config/locales/de-DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ de:
ineligible: untauglich
ineligible_description: untauglich
topics:
nature: Natur und biologische Vielfalt
nature_description: Natur und biologische Vielfalt
nature: Natur und Artenvielfalt
nature_description: Natur und Artenvielfalt
waste: Sauberkeit und Abfall
waste_description: Sauberkeit und Abfall
sustainability: Nachhaltige Entwicklung
Expand All @@ -45,7 +45,7 @@ de:
housing: Wohnen
housing_description: Wohnen
public_space: Öffentlicher Raum
public_space_description: Öffentliche Räume und Gebäude
public_space_description: Öffentlicher Raum
safety: Sicherheit
safety_description: Sicherheit
education: Bildung und Jugend
Expand All @@ -57,11 +57,11 @@ de:
inclusion: Gemeinschaftlicher Zusammenhalt
inclusion_description: Soziale Inklusion
community: Aufbau und Entwicklung einer Community
community_description: Entwicklung der Gemeinschaft
community_description: Quartiersentwicklung
services: Öffentliche Dienstleistungen
services_description: Öffentliche Dienste
other: Andere
other_description: Andere
services_description: Öffentliche Dienstleistungen
other: Sonstiges
other_description: Sonstiges
static_pages:
terms_and_conditions_title: Nutzungsbedingungen
terms_and_conditions_body: >
Expand Down
10 changes: 5 additions & 5 deletions back/spec/acceptance/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@

context 'when the user_confirmation module is active' do
before do
allow(RequestConfirmationCodeJob).to receive(:perform_later)
allow(RequestConfirmationCodeJob).to receive(:perform_now)
SettingsService.new.activate_feature! 'user_confirmation'
end

Expand All @@ -170,7 +170,7 @@
assert_status 201
json_response = json_parse(response_body)
user = User.order(:created_at).last
expect(RequestConfirmationCodeJob).to have_received(:perform_later).with(user).once
expect(RequestConfirmationCodeJob).to have_received(:perform_now).with(user).once
expect(json_response.dig(:data, :attributes, :confirmation_required)).to be true # when no custom fields
end
end
Expand Down Expand Up @@ -292,15 +292,15 @@
let(:locale) { 'en' }

before do
allow(RequestConfirmationCodeJob).to receive(:perform_later)
allow(RequestConfirmationCodeJob).to receive(:perform_now)
SettingsService.new.activate_feature! 'user_confirmation'
end

describe 'create a user with no password' do
example_request 'User successfully created and requires confirmation' do
assert_status 201
user = User.order(:created_at).last
expect(RequestConfirmationCodeJob).to have_received(:perform_later).with(user).once
expect(RequestConfirmationCodeJob).to have_received(:perform_now).with(user).once
expect(response_data.dig(:attributes, :confirmation_required)).to be(true)
end

Expand All @@ -319,7 +319,7 @@
do_request
assert_status 200
expect(response_data.dig(:attributes, :confirmation_required)).to be(true)
expect(RequestConfirmationCodeJob).to have_received(:perform_later).with(existing_user).once
expect(RequestConfirmationCodeJob).to have_received(:perform_now).with(existing_user).once
end

context 'when the request tries to pass additional changed attributes', document: false do
Expand Down
16 changes: 8 additions & 8 deletions cl2-component-library/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cl2-component-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.5",
"@rollup/plugin-commonjs": "^25.0.2",
"@rollup/plugin-node-resolve": "^15.2.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-typescript": "^9.0.2",
"@storybook/addon-actions": "^7.4.0",
"@storybook/addon-docs": "^7.5.1",
Expand Down
22 changes: 22 additions & 0 deletions front/app/components/UI/QuillEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ const Container = styled.div<{
remove: string;
maxHeight?: string;
minHeight?: string;
scrollTop: number;
}>`
.ql-snow.ql-toolbar button:hover .ql-stroke,
.ql-snow .ql-toolbar button:hover .ql-stroke,
Expand Down Expand Up @@ -167,6 +168,12 @@ const Container = styled.div<{
color: ${colors.teal};
}
.ql-tooltip {
top: ${(props) => props.scrollTop + 20}px !important;
left: 50% !important;
transform: translate(-50%);
}
.ql-tooltip[data-mode='link']::before {
content: '${(props) => props.linkPrompt}' !important;
}
Expand Down Expand Up @@ -404,13 +411,27 @@ const QuillEditor = memo<Props>(
const toolbarId = !noToolbar ? `ql-editor-toolbar-${id}` : null;
const { formatMessage } = useIntl();
const [editor, setEditor] = useState<Quill | null>(null);
const [scrollTop, setScrollTop] = useState<number>(0);
const contentRef = useRef<string>(value || '');
const prevEditor = usePrevious(editor);
const [focussed, setFocussed] = useState(false);
const prevFocussed = usePrevious(focussed);
const editorRef = useRef<HTMLDivElement>(null);
const [isButtonsMenuVisible, setIsButtonsMenuVisible] = useState(false);

useEffect(() => {
const eventListenerHandler = debounce(() => {
setScrollTop(editorRef.current?.scrollTop || 0);
}, 100);
const scrollContainer = editorRef.current;
if (scrollContainer) {
scrollContainer.addEventListener('scroll', eventListenerHandler);
}
return () => {
scrollContainer?.removeEventListener('scroll', eventListenerHandler);
};
}, []);

const toggleButtonsMenu = useCallback(
() => setIsButtonsMenuVisible((value) => !value),
[]
Expand Down Expand Up @@ -697,6 +718,7 @@ const QuillEditor = memo<Props>(
save={formatMessage(messages.save)}
edit={formatMessage(messages.edit)}
remove={formatMessage(messages.remove)}
scrollTop={scrollTop}
>
{label && (
<Label htmlFor={id} onClick={handleLabelOnClick}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ const TopBar = () => {
icon="info-solid"
buttonStyle="text"
openLinkInNewTab
linkTo={formatMessage(messages.supportArticle)}
linkTo={formatMessage(messages.supportArticleLink)}
iconColor={colors.grey800}
/>
{isFiltersOpen && <Filters onClose={() => setIsFiltersOpen(false)} />}
Expand Down
Loading

0 comments on commit 00218eb

Please sign in to comment.