Skip to content

Commit 2d76aa6

Browse files
authored
Merge branch 'develop' into art/2000/pii-correlation
2 parents 5cc919e + e30df32 commit 2d76aa6

46 files changed

Lines changed: 1047 additions & 53 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci-cd.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ env:
1515
permissions:
1616
actions: write
1717
contents: read
18-
issues: read
19-
pull-requests: read
18+
issues: write
19+
pull-requests: write
2020

2121
jobs:
2222
rubocop:
@@ -62,7 +62,7 @@ jobs:
6262

6363
services:
6464
mysql: &db-service
65-
image: mysql:8.0
65+
image: mysql:8.4.2 # please keep the image in sync with Dockerfile.db
6666
env:
6767
MYSQL_ROOT_HOST: '%'
6868
MYSQL_ROOT_PASSWORD: 'root'
@@ -80,7 +80,13 @@ jobs:
8080
- name: Setup dependencies
8181
run: |
8282
sudo apt-get -qq update
83-
sudo apt-get -yqq install libmariadb-dev libmagickwand-dev
83+
sudo apt-get -yqq install libmariadb-dev \
84+
libmagickwand-dev \
85+
mariadb-client
86+
- name: Report database client versions
87+
run: |
88+
mysql --version
89+
mysqldump --version
8490
- name: Setup Ruby
8591
uses: ruby/setup-ruby@v1
8692
with:
@@ -181,3 +187,22 @@ jobs:
181187
-i ~/.ssh/deploy.key \
182188
"$SSH_USER"@"$SSH_IP" \
183189
"sudo su -l qpixel /var/apps/deploy-dev"
190+
191+
db_changes:
192+
name: Check for data dump changes
193+
runs-on: ubuntu-latest
194+
if: ${{ github.event_name == 'pull_request' && github.actor != 'dependabot[bot]' }}
195+
196+
steps:
197+
- name: Checkout repo
198+
uses: actions/checkout@v3
199+
- name: Setup Ruby
200+
uses: ruby/setup-ruby@v1
201+
with:
202+
ruby-version: 3.4
203+
bundler-cache: true
204+
- name: Check for changes
205+
run: |
206+
bundle exec ruby lib/database_changes_checker.rb origin/${{ github.event.pull_request.base.ref }} \
207+
origin/${{ github.event.pull_request.head.ref }} ${{ secrets.GITHUB_TOKEN }} \
208+
${{ github.event.pull_request.number }}

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ AllCops:
88
Exclude:
99
- 'config/**/*'
1010
- 'db/schema.rb'
11+
- 'docker/mysql/**/*'
1112
- 'scripts/**/*'
1213
- 'bin/**/*'
1314
- 'lib/namespaced_env_cache.rb'

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ end
102102

103103
group :development, :test do
104104
gem 'byebug', '~> 11.1'
105+
gem 'octokit', '~> 10.0'
105106
end
106107

107108
group :development do

Gemfile.lock

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,12 @@ GEM
164164
erb (6.0.3)
165165
erubi (1.13.1)
166166
execjs (2.10.1)
167+
faraday (2.14.2)
168+
faraday-net_http (>= 2.0, < 3.5)
169+
json
170+
logger
171+
faraday-net_http (3.4.3)
172+
net-http (~> 0.5)
167173
fastimage (2.4.1)
168174
ffi (1.17.4-x86_64-linux-gnu)
169175
flamegraph (0.9.5)
@@ -251,6 +257,8 @@ GEM
251257
mutex_m (0.3.0)
252258
mysql2 (0.5.7)
253259
bigdecimal
260+
net-http (0.9.1)
261+
uri (>= 0.11.1)
254262
net-imap (0.6.3)
255263
date
256264
net-protocol
@@ -264,6 +272,9 @@ GEM
264272
nokogiri (1.19.2-x86_64-linux-gnu)
265273
racc (~> 1.4)
266274
observer (0.1.2)
275+
octokit (10.0.0)
276+
faraday (>= 1, < 3)
277+
sawyer (~> 0.9)
267278
omniauth (2.1.4)
268279
hashie (>= 3.4.6)
269280
logger
@@ -412,6 +423,9 @@ GEM
412423
sprockets (> 3.0)
413424
sprockets-rails
414425
tilt
426+
sawyer (0.9.3)
427+
addressable (>= 2.3.5)
428+
faraday (>= 0.17.3, < 3)
415429
securerandom (0.4.1)
416430
selenium-webdriver (4.10.0)
417431
rexml (~> 3.2, >= 3.2.5)
@@ -457,6 +471,7 @@ GEM
457471
unicode-display_width (3.2.0)
458472
unicode-emoji (~> 4.1)
459473
unicode-emoji (4.2.0)
474+
uri (1.1.1)
460475
useragent (0.16.11)
461476
warden (1.2.9)
462477
rack (>= 2.0.9)
@@ -528,6 +543,7 @@ DEPENDENCIES
528543
mutex_m (~> 0.3)
529544
mysql2 (~> 0.5.4)
530545
net-smtp (~> 0.3)
546+
octokit (~> 10.0)
531547
omniauth (~> 2.1)
532548
premailer-rails (~> 1.11)
533549
puma (~> 5.6)

INSTALLATION.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ sudo apt install autoconf bison build-essential libssl-dev libyaml-dev libreadli
2626
sudo apt install mysql-server libmysqlclient-dev
2727
```
2828

29+
For Red Hat-Based Linux:
30+
31+
```
32+
sudo dnf install gcc make pkg-config
33+
sudo dnf install autoconf bison @development-tools openssl-libs libyaml-devel readline-devel zlibrary-devel ncurses-devel libffi-devel gdbm-devel
34+
sudo dnf install mysql-server mysql-devel
35+
```
36+
2937
For Arch-Based Linux:
3038

3139
```
@@ -131,6 +139,7 @@ the MySQL server with `sudo mysql -u root` and create a new database user for QP
131139
CREATE USER qpixel@localhost IDENTIFIED BY 'choose_a_password_here';
132140
GRANT ALL ON qpixel_dev.* TO qpixel@localhost;
133141
GRANT ALL ON qpixel_test.* TO qpixel@localhost;
142+
GRANT ALL ON qpixel_dump.* TO qpixel@localhost;
134143
GRANT ALL ON qpixel.* TO qpixel@localhost;
135144
```
136145

app/assets/stylesheets/utilities.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,10 @@ span.spoiler {
381381
white-space: nowrap;
382382
}
383383

384+
.fit-content {
385+
min-width: fit-content;
386+
}
387+
384388
@each $side in $sides {
385389
.border-#{$side}-none {
386390
border-#{$side}: none;

app/controllers/comments_controller.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def create_thread
5858
notification = "New comment thread on #{@comment.root.title}: #{@comment_thread.title}"
5959

6060
NewThreadFollower.where(post: @post).each do |ntf|
61-
unless ntf.user.same_as?(current_user)
61+
unless ntf.user.same_as?(current_user) || pings.include?(ntf.user_id)
6262
ntf.user.create_notification(notification, helpers.comment_link(@comment))
6363
end
6464
ThreadFollower.create(user: ntf.user, comment_thread: @comment_thread)
@@ -92,9 +92,8 @@ def create
9292
.where('link LIKE ?', "#{thread_url}%")
9393
next if existing_notification.exists?
9494

95-
title = @post.parent.nil? ? @post.title : @post.parent.title
9695
follower.user.create_notification("There are new comments in a followed thread '#{@comment_thread.title}' " \
97-
"on the post '#{title}'",
96+
"on the post '#{@comment.root.title}'",
9897
helpers.comment_link(@comment))
9998
end
10099
else
@@ -473,16 +472,15 @@ def restrict_thread_response(thread, status)
473472

474473
# @param pings [Array<Integer>] list of pinged user ids
475474
def apply_pings(pings)
475+
context = @comment_thread.comments.first.same_as?(@comment) ? 'new' : 'comment in the'
476+
notification_text =
477+
"You were mentioned in a #{context} thread '#{@comment_thread.title}' on the post '#{@comment.root.title}'"
478+
476479
pings.each do |p|
477480
user = User.where(id: p).first
478481
next if user.nil?
479482

480-
next if user.same_as?(@comment.post.user)
481-
482-
title = @post.parent.nil? ? @post.title : @post.parent.title
483-
user.create_notification("You were mentioned in a comment in the thread '#{@comment_thread.title}' " \
484-
"on the post '#{title}'",
485-
helpers.comment_link(@comment))
483+
user.create_notification(notification_text, helpers.comment_link(@comment))
486484
end
487485
end
488486

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
class DumpsController < ApplicationController
2+
before_action :authenticate_user!
3+
4+
def index
5+
@latest = Dump.automatic.last
6+
@others = Dump.manual
7+
end
8+
end

app/helpers/application_helper.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,13 @@ def generic_show_link(post)
250250

251251
##
252252
# Split a string after a specified number of characters, only breaking at word boundaries.
253+
# @deprecated Use {String#truncate}[https://www.rubydoc.info/gems/activesupport/String#truncate-instance_method].
253254
# @param text [String] The text to split.
254255
# @param max_length [Integer] The maximum number of characters to leave in the resulting strings.
255256
# @return [Array<String>]
256257
def split_words_max_length(text, max_length)
258+
logger.warn 'ApplicationHelper#split_words_max_length is deprecated. Use String#truncate instead.'
259+
logger.warn caller[0]
257260
words = text.split
258261
splat = [[]]
259262
words.each do |word|

app/helpers/dumps_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
module DumpsHelper
2+
end

0 commit comments

Comments
 (0)