Merge branch 'main' into feature/stimulus-character-count

This commit is contained in:
Andreas Nedbal 2022-10-31 20:56:38 +01:00
commit 15d05f1699
127 changed files with 177 additions and 130 deletions

View File

@ -26,7 +26,7 @@ gem "devise-i18n"
gem "fog-aws"
gem "fog-core"
gem "fog-local"
gem "haml", "~> 5.0"
gem "haml", "~> 6.0"
gem "hcaptcha", "~> 7.0"
gem "mini_magick"
gem "oj"
@ -35,7 +35,7 @@ gem "rqrcode"
gem "rolify", "~> 6.0"
gem "dry-initializer", "~> 3.1"
gem "dry-types", "~> 1.4"
gem "dry-types", "~> 1.6"
gem "ruby-progressbar"
@ -95,10 +95,10 @@ group :development, :test do
gem "rake"
gem "rspec-its", "~> 1.3"
gem "rspec-mocks"
gem "rspec-rails", "~> 5.1"
gem "rspec-rails", "~> 6.0"
gem "rspec-sidekiq", "~> 3.0", require: false
gem "rubocop", "~> 1.37"
gem "rubocop-rails", "~> 2.16"
gem "rubocop-rails", "~> 2.17"
gem "shoulda-matchers", "~> 5.2"
gem "simplecov", require: false
gem "simplecov-cobertura", require: false

View File

@ -143,28 +143,27 @@ GEM
docile (1.4.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dry-configurable (0.13.0)
dry-container (0.11.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.6)
dry-container (0.9.0)
dry-core (0.9.0)
concurrent-ruby (~> 1.0)
dry-configurable (~> 0.13, >= 0.13.0)
dry-core (0.7.1)
concurrent-ruby (~> 1.0)
dry-inflector (0.2.1)
zeitwerk (~> 2.6)
dry-inflector (0.3.0)
dry-initializer (3.1.1)
dry-logic (1.2.0)
dry-logic (1.3.0)
concurrent-ruby (~> 1.0)
dry-core (~> 0.5, >= 0.5)
dry-types (1.5.1)
dry-core (~> 0.9, >= 0.9)
zeitwerk (~> 2.6)
dry-types (1.6.1)
concurrent-ruby (~> 1.0)
dry-container (~> 0.3)
dry-core (~> 0.5, >= 0.5)
dry-core (~> 0.9, >= 0.9)
dry-inflector (~> 0.1, >= 0.1.2)
dry-logic (~> 1.0, >= 1.0.2)
dry-logic (~> 1.3, >= 1.3)
zeitwerk (~> 2.6)
equalizer (0.0.11)
erubi (1.11.0)
excon (0.92.3)
excon (0.93.1)
factory_bot (6.2.0)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
@ -179,7 +178,7 @@ GEM
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
rake
fog-aws (3.14.0)
fog-aws (3.15.0)
fog-core (~> 2.1)
fog-json (~> 1.1)
fog-xml (~> 0.1)
@ -214,8 +213,9 @@ GEM
guard (>= 2.0.0)
guard-compat (~> 1.0)
guard-compat (1.2.1)
haml (5.2.2)
temple (>= 0.8.0)
haml (6.0.8)
temple (>= 0.8.2)
thor
tilt
haml_lint (0.42.0)
haml (>= 4.0, < 6.1)
@ -312,7 +312,7 @@ GEM
net-protocol
net-protocol (0.1.3)
timeout
net-smtp (0.3.2)
net-smtp (0.3.3)
net-protocol
nio4r (2.5.8)
nokogiri (1.13.9)
@ -340,7 +340,7 @@ GEM
parallel (1.22.1)
parser (3.1.2.1)
ast (~> 2.4.1)
pg (1.4.3)
pg (1.4.4)
pghero (3.0.1)
activerecord (>= 6)
poltergeist (1.18.1)
@ -351,7 +351,7 @@ GEM
coderay (~> 1.1)
method_source (~> 1.0)
public_suffix (4.0.7)
puma (5.6.5)
puma (6.0.0)
nio4r (~> 2.0)
questiongenerator (1.0.0)
racc (1.6.0)
@ -421,29 +421,29 @@ GEM
chunky_png (~> 1.0)
rqrcode_core (~> 1.0)
rqrcode_core (1.2.0)
rspec-core (3.11.0)
rspec-support (~> 3.11.0)
rspec-expectations (3.11.0)
rspec-core (3.12.0)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-support (~> 3.12.0)
rspec-its (1.3.0)
rspec-core (>= 3.0.0)
rspec-expectations (>= 3.0.0)
rspec-mocks (3.11.1)
rspec-mocks (3.12.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.11.0)
rspec-rails (5.1.2)
actionpack (>= 5.2)
activesupport (>= 5.2)
railties (>= 5.2)
rspec-core (~> 3.10)
rspec-expectations (~> 3.10)
rspec-mocks (~> 3.10)
rspec-support (~> 3.10)
rspec-support (~> 3.12.0)
rspec-rails (6.0.1)
actionpack (>= 6.1)
activesupport (>= 6.1)
railties (>= 6.1)
rspec-core (~> 3.11)
rspec-expectations (~> 3.11)
rspec-mocks (~> 3.11)
rspec-support (~> 3.11)
rspec-sidekiq (3.1.0)
rspec-core (~> 3.0, >= 3.0.0)
sidekiq (>= 2.4.0)
rspec-support (3.11.0)
rspec-support (3.12.0)
rubocop (1.37.1)
json (~> 2.3)
parallel (~> 1.10)
@ -456,7 +456,7 @@ GEM
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.23.0)
parser (>= 3.1.1.0)
rubocop-rails (2.16.1)
rubocop-rails (2.17.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
@ -513,7 +513,7 @@ GEM
activesupport (>= 5.2)
sprockets (>= 3.0.0)
sysexits (1.2.0)
temple (0.8.2)
temple (0.9.1)
thor (1.2.1)
thread_safe (0.3.6)
tilt (2.0.11)
@ -587,7 +587,7 @@ DEPENDENCIES
devise-async
devise-i18n
dry-initializer (~> 3.1)
dry-types (~> 1.4)
dry-types (~> 1.6)
factory_bot_rails
fake_email_validator
faker
@ -595,7 +595,7 @@ DEPENDENCIES
fog-core
fog-local
guard-brakeman
haml (~> 5.0)
haml (~> 6.0)
haml_lint
hcaptcha (~> 7.0)
httparty
@ -628,10 +628,10 @@ DEPENDENCIES
rqrcode
rspec-its (~> 1.3)
rspec-mocks
rspec-rails (~> 5.1)
rspec-rails (~> 6.0)
rspec-sidekiq (~> 3.0)
rubocop (~> 1.37)
rubocop-rails (~> 2.16)
rubocop-rails (~> 2.17)
ruby-progressbar
sanitize
sassc-rails

View File

@ -4,7 +4,6 @@ module LayoutsHelper
def parent_layout(layout)
@view_flow.set(:layout, output_buffer)
output = render(template: "layouts/#{layout}")
@haml_buffer.buffer.replace output
self.output_buffer = ActionView::OutputBuffer.new(output)
end
end

View File

@ -1,6 +1,6 @@
import registerEvents from "retrospring/utilities/registerEvents";
import { commentDestroyHandler } from "./destroy";
import { commentCreateHandler } from "./new";
import {commentComposeEnd, commentComposeStart, commentCreateHandler} from "./new";
import { commentReportHandler } from "./report";
import { commentSmileHandler } from "./smile";
import { commentToggleHandler } from "./toggle";
@ -11,6 +11,8 @@ export default (): void => {
{ type: 'click', target: '[name=ab-smile-comment]', handler: commentSmileHandler, global: true },
{ type: 'click', target: '[data-action=ab-comment-report]', handler: commentReportHandler, global: true },
{ type: 'click', target: '[data-action=ab-comment-destroy]', handler: commentDestroyHandler, global: true },
{ type: 'compositionstart', target: '[name=ab-comment-new]', handler: commentComposeStart, global: true },
{ type: 'compositionend', target: '[name=ab-comment-new]', handler: commentComposeEnd, global: true },
{ type: 'keyup', target: '[name=ab-comment-new]', handler: commentCreateHandler, global: true }
]);
}

View File

@ -3,7 +3,14 @@ import { post } from '@rails/request.js';
import I18n from 'retrospring/i18n';
import { showNotification, showErrorNotification } from 'utilities/notifications';
let compositionJustEnded = false;
export function commentCreateHandler(event: KeyboardEvent): boolean {
if (compositionJustEnded && event.which == 13) {
compositionJustEnded = false;
return;
}
const input = event.target as HTMLInputElement;
const id = input.dataset.aId;
const counter = document.querySelector(`#ab-comment-charcount-${id}`);
@ -31,13 +38,16 @@ export function commentCreateHandler(event: KeyboardEvent): boolean {
if (data.success) {
document.querySelector(`#ab-comments-${id}`).innerHTML = data.render;
document.querySelector(`#ab-comment-count-${id}`).innerHTML = data.count;
const commentCount = document.getElementById(`#ab-comment-count-${id}`);
if (commentCount) {
commentCount.innerHTML = data.count;
}
input.value = '';
counter.innerHTML = String(160);
const sub = document.querySelector<HTMLElement>(`[data-action=ab-submarine][data-a-id="${id}"]`);
sub.dataset.torpedo = "no"
sub.children[0].nextSibling.textContent = ' ' + I18n.translate('views.actions.unsubscribe');
sub.children[0].nextSibling.textContent = ' ' + I18n.translate('voc.unsubscribe');
}
showNotification(data.message, data.success);
@ -52,11 +62,12 @@ export function commentCreateHandler(event: KeyboardEvent): boolean {
}
}
export function commentInputHandler(event: KeyboardEvent): void {
const input = event.target as HTMLInputElement;
const inboxId = input.dataset.id;
if (event.keyCode == 13 && (event.ctrlKey || event.metaKey)) {
document.querySelector<HTMLButtonElement>(`button[name="ab-comment-new"][data-abc-id="${inboxId}"]`).click();
}
export function commentComposeStart(): boolean {
compositionJustEnded = false;
return true;
}
export function commentComposeEnd(): boolean {
compositionJustEnded = true;
return true;
}

View File

@ -1,14 +1,9 @@
// Font settings
$lato-font-path: "~lato-font/fonts";
$lato-variants: (
"normal" : 400,
"semibold" : 500,
"bold" : 600,
);
$lexend-font-path: "~@fontsource/lexend/files";
$lexend-weights: 500, 600;
$fa-font-path: "~font-awesome/fonts";
$fa-font-path: "~font-awesome/fonts";
$font-family-sans-serif: "Lato","Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
$font-family-sans-serif: "Lexend", "Open Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
$font-family-serif: Georgia, "DejaVu Serif", "Times New Roman", Times, serif;
$font-family-monospace: "PragmataPro", Monaco, "Ubuntu Mono", Menlo, "DejaVu Sans Mono", monospace;
$font-family-base: $font-family-sans-serif;
@ -41,7 +36,7 @@ $nprogress-color: lighten($primary, 25%);
// Color names for theme generation
$color-names: (
"primary",
"primary",
"danger",
"warning",
"info",
@ -83,7 +78,7 @@ $spacers: (
color: RGB(var(--*-text));
And for transparent usage, use:
color: rgba(var(--*-text), .7);
color: rgba(var(--*-text), .7);
The uppercase RGB is required because internally
SassC wants more than one argument for rgb(),

View File

@ -4,6 +4,7 @@
Variable definitions, tools and mixins used
across all styling definitions.
*/
@use "~@fontsource/lexend/scss/mixins" as Lexend;
@import
"variables";
@ -19,10 +20,31 @@
"~bootstrap/scss/bootstrap",
"~croppr/dist/croppr",
"~font-awesome/scss/font-awesome",
"~lato-font/scss/lato-font",
"~sweetalert/dist/sweetalert",
"~toastify-js/src/toastify";
@each $weight in $lexend-weights {
@include Lexend.fontFace(
$weight: $weight,
$display: fallback,
$fontDir: "~@fontsource/lexend/files"
);
}
// Using Lexend Light (300) as Regular (400) as Regular is quite thick.
@each $subset, $unicodeRangeValues in Lexend.$unicodeMap {
@font-face {
font-family: Lexend;
font-style: normal;
font-display: swap;
font-weight: 400;
src: url("#{Lexend.$fontDir}/lexend-#{$subset}-300-normal.woff2") format("woff2"),
url("#{Lexend.$fontDir}/lexend-all-300-normal.woff") format("woff");
unicode-range: $unicodeRangeValues;
}
}
/**
OVERRIDES
----------------------------------------------

View File

@ -1,3 +1,7 @@
.sweet-alert {
font-family: inherit;
}
.sweet-overlay {
z-index: 1031;
}
}

View File

@ -6,6 +6,6 @@
= t(".empty")
- if @more_data_available
.d-flex.justify-content-center.justify-content-sm-start#paginator
.d-flex.justify-content-center#paginator
= button_to inbox_path(last_id: @inbox_last_id), class: "btn btn-light" do
= t("voc.load")

View File

@ -4,4 +4,5 @@
= render 'layouts/messages'
= render 'tabs/feed', lists: @lists, list: @list
= yield
.d-block.d-sm-none= render 'shared/links'
= render 'shared/links'

View File

@ -12,5 +12,7 @@
.card-body
= yield
= render 'shared/links'
:ruby
parent_layout "base"

View File

@ -5,6 +5,8 @@
.col-md-9.col-xs-12.col-sm-8
= yield
.d-block.d-sm-none= render "shared/links"
:ruby
Notification.for(current_user).update_all(new: false)
parent_layout 'base'

View File

@ -15,3 +15,5 @@
- if current_user.mod? && @user != current_user
= render 'modal/privileges', user: @user
= render 'modal/ban', user: @user
.d-block.d-sm-none= render 'shared/links'

View File

@ -5,3 +5,5 @@
.col-md-9.col-xs-12.col-sm-8
= render 'layouts/messages'
= yield
.d-block.d-sm-none= render "shared/links"

View File

@ -9,6 +9,6 @@
= render "inbox/entry", i: i
- if @more_data_available
.d-flex.justify-content-center.justify-content-sm-start#paginator
.d-flex.justify-content-center#paginator
= button_to mod_inbox_index_path(@user, last_id: @inbox_last_id), class: "btn btn-light" do
= t("voc.load")

View File

@ -23,11 +23,11 @@
.dropdown-divider
- if current_user.mod?
- if moderation_view?
= link_to moderation_toggle_unmask_path, method: :post, class: "dropdown-item" do
= link_to moderation_toggle_unmask_path, class: "dropdown-item", data: { turbo_method: :post } do
%i.fa.fa-toggle-on
= t(".unmask.disable")
- else
= link_to moderation_toggle_unmask_path, method: :post, class: "dropdown-item" do
= link_to moderation_toggle_unmask_path, class: "dropdown-item", data: { turbo_method: :post } do
%i.fa.fa-toggle-off
= t(".unmask.enable")
%a.dropdown-item{ href: mod_anon_block_index_path }

View File

@ -19,5 +19,3 @@
%hr/
%p= t(".delete.heading")
%p= link_to t(".delete.action"), "/settings/account", data: { turbo_confirm: t(".delete.confirm"), turbo_method: :delete }, class: "btn btn-danger btn-xs"
.visible-xs= render "shared/links"

Some files were not shown because too many files have changed in this diff Show More