Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
380 commits
Select commit Hold shift + click to select a range
8c4a3f8
Start with migration to rails 6.0
Taeir Sep 12, 2022
f3957cf
Update schema
Taeir Aug 25, 2022
8df8b50
Fix warnings for case insensitive uniqueness validations
Taeir Aug 25, 2022
1cba6e4
Enable all safe new defaults
Taeir Aug 25, 2022
10b184c
Fix deprecated where.not usage
Taeir Aug 25, 2022
4ed47df
Fix content_type test
Taeir Aug 25, 2022
caaa40b
Update dependencies
Taeir Aug 25, 2022
07e0e9d
Please the linter gods
Taeir Aug 26, 2022
ba90ab6
Fix docker image
Taeir Aug 26, 2022
ee5b3df
Update spring, only load spring in development
Taeir Aug 26, 2022
2f6ef2a
Fix deprecation warnings for rmagick
Taeir Aug 26, 2022
cc73bd1
Check media type rather than content type
Taeir Aug 26, 2022
e9acd15
Enable other safe defaults (not using sidekiq or resque)
Taeir Aug 27, 2022
65a9559
Remove comments of safely updated packages
Taeir Sep 1, 2022
e77bd6f
Update redis library to v5
Taeir Sep 1, 2022
edd3a1c
Switch to rails 6 defaults and cleanup safe settings
Taeir Sep 1, 2022
6cf9a46
Fix files without .html extension
Taeir Sep 1, 2022
76bfd41
Run rails 6.1 update procedure
Taeir Sep 1, 2022
53897ef
Fix rails 6 image uploading
Taeir Sep 1, 2022
93bc9fb
Toggle safe rails 6.1 settings
Taeir Sep 1, 2022
eda29fa
Fix assets
Taeir Sep 1, 2022
a996013
Upgrade puma and clean up Gemfile
Taeir Sep 1, 2022
13823b6
Add missing optional mentions on belongs_to relations
Taeir Sep 2, 2022
0d2ac7e
Add missing translation
Taeir Sep 2, 2022
4997d7d
Fix flag fixture polymorphic relation without type
Taeir Sep 2, 2022
46d39b5
Fix categories controller test
Taeir Sep 2, 2022
2f293d7
Don't spam codidact.com during the tests
Taeir Sep 2, 2022
405c680
Update sass-rails to sassc-rails
Taeir Sep 3, 2022
dae5fb9
Fix help posts not editable
Taeir Sep 4, 2022
dc4d829
Ensure saved value is string in redis
Taeir Sep 9, 2022
b258ec2
Replace deprecated method with correct one
Taeir Sep 9, 2022
aa2250b
Fix caching
Taeir Sep 9, 2022
de53aaa
Fix rubocop errors
Taeir Sep 9, 2022
29ca3d3
Properly use redis in tests
Taeir Sep 9, 2022
08ecfcf
Use fully qualified name for redis
Taeir Sep 9, 2022
64c466c
Remove new defaults initializer
Taeir Sep 12, 2022
9e6b4d8
Start with migration to rails 6.0
Taeir Sep 12, 2022
e2026d3
Upgrade to rails 7
Taeir Sep 3, 2022
d882265
Update sass-rails to sassc-rails
Taeir Sep 3, 2022
e9a7d7f
Use sprockets 4
Taeir Sep 3, 2022
7591c7c
Switch to terser for js compression
Taeir Sep 4, 2022
e9f5ae9
Add schema version
Taeir Sep 4, 2022
bce0197
Switch to rails 7.0 defaults
Taeir Sep 4, 2022
1624284
Fix linter error
Taeir Sep 4, 2022
c5c7844
Update installation instructions
Taeir Sep 12, 2022
9146c80
Update schema for 7
ArtOfCode- Sep 12, 2022
3edb77b
Fix CI images
Taeir Sep 12, 2022
48da4af
Add ruby 3 support
Taeir Sep 12, 2022
d1166ab
Update omniauth
Taeir Sep 12, 2022
905f9cf
Add ability to create tags for mods
Taeir Sep 12, 2022
c649581
Prevent updating of tag names
Taeir Sep 12, 2022
3ce2275
Bump co-design version to 0.12.5
sau226 Jun 11, 2022
4992009
Add ability to follow new comment threads on a post; close #819
ArtOfCode- Sep 13, 2022
659f0c9
Changed error messages to avoid 'tags can't have more than 5 tags' co…
cellio Sep 20, 2022
4e42309
Apparently there is actually a save
MoshiKoi Sep 21, 2022
f3fdd56
Do not display closed posts in hot posts
Taeir Sep 15, 2022
170a091
Also hide locked posts
Taeir Sep 22, 2022
3326fd2
Report redis errors and inherit sockets for development
Taeir Sep 21, 2022
c2ada5f
Add missing relation
Taeir Sep 21, 2022
4ff4833
In seeding, actually link to the corresponding objects
Taeir Sep 21, 2022
d3fd074
Add required license field for communities
Taeir Sep 21, 2022
a38be9a
Revert redis to version 4 until issue is fixed and update settings
Taeir Sep 22, 2022
875fa72
Generalized wording on vote-summary page so it works for both you and…
cellio Sep 30, 2022
d5b7a4c
Don't rerender the preview if nothing changed
MoshiKoi Oct 9, 2022
f670c19
Add back still required install instructions
Taeir Oct 25, 2022
e91cdb3
Fix error in docker
Taeir Oct 27, 2022
5a77f8a
Ensure docker works out of the box
Taeir Oct 27, 2022
72b34d2
Add some notes on docker compose and Mac
Taeir Oct 27, 2022
d51d591
Also create storage config in docker
Taeir Oct 27, 2022
b739e2a
Wait until mysql is up properly
Taeir Oct 27, 2022
4e29a1c
Remove outdated config option
Taeir Oct 31, 2022
4094c66
Add net votes for each day to the vote summary
MoshiKoi Oct 10, 2022
e1350ab
Fix upload redirects
ArtOfCode- Nov 24, 2022
45459ad
Asyncify to fix error
ArtOfCode- Nov 24, 2022
b5ce5be
Bump nokogiri from 1.13.8 to 1.13.9
dependabot[bot] Nov 24, 2022
b588748
Bump commonmarker from 0.23.5 to 0.23.6
dependabot[bot] Nov 24, 2022
66c4d4d
Add SAML support
Taeir Sep 15, 2022
2c5b72c
Fix routes and update links in UI
Taeir Aug 19, 2022
6e1e20a
Add 2FA support
Taeir Aug 19, 2022
594bfb4
Apply code suggestions from ArtOfCode
Taeir Aug 23, 2022
9982de3
Fix mistake in attribute map
Taeir Aug 23, 2022
11b7bd6
Use helpers in devise
Taeir Aug 29, 2022
db4ac6a
Add SSO Sign in button on normal sign in page
Taeir Aug 29, 2022
c718a57
Fix links to SAML
Taeir Aug 29, 2022
a8ccc88
Add sign in with sso notice on registrations page
Taeir Aug 29, 2022
e8c6777
Add setting to control 2FA usage of SSO users
Taeir Nov 26, 2022
394df08
Disallow SSO users from changing email/password
Taeir Nov 26, 2022
8e2cf3e
Enforce that SSO users sign-in with SSO
Taeir Nov 26, 2022
2bb50a0
Allow disconnect account from SSO when mixed
Taeir Nov 26, 2022
54cf8a0
Check for mixed sign in before allowing SSO disconnect
Taeir Nov 26, 2022
1e5d6ed
Fix impersonation with SSO
Taeir Nov 26, 2022
bbd16d3
Consistently use Single Sign-On rather than Single Sign On
Taeir Nov 26, 2022
14149b1
Bump loofah from 2.18.0 to 2.19.1
dependabot[bot] Dec 13, 2022
cd68b1f
Bump rails-html-sanitizer from 1.4.3 to 1.4.4
dependabot[bot] Dec 14, 2022
48fd3ba
Remove caching that killed the server
ArtOfCode- Jan 2, 2023
f5ff803
changed order of fields (current pwd first, then new pwd & confirmation)
cellio Jan 2, 2023
75a7d8f
clarified field labels
cellio Jan 2, 2023
0688462
Fix double bracketed footnotes
MoshiKoi Dec 28, 2022
a7a67ac
Prevent selection of nonexistent parent tag
MoshiKoi Dec 29, 2022
d046eda
Fix tour test for the 3rd time
Taeir Jan 3, 2023
dac23b4
Move see-all-notifications button to top
MoshiKoi Jan 3, 2023
af05474
Add notifications tab to user page
MoshiKoi Jan 3, 2023
a6e6ca8
Fix CI issues
Taeir Jan 3, 2023
b158517
Apply consistently between sessions_controller and saml version
Taeir Jan 3, 2023
b0cd00a
Fix old internal link that no longer needs a number
trichoplax Jan 16, 2023
33c8d77
Add missing backtick that was hiding a heading from rendered markdown
trichoplax Jan 16, 2023
d2579cf
Replace abandoned heading number with heading wording
trichoplax Jan 16, 2023
392c42e
Use correct path in link text to avoid confusion
trichoplax Jan 16, 2023
8040dee
Add missing word and wrap very long line
trichoplax Jan 16, 2023
fef5828
Replace fake footnotes that unexpectedly linked off page
trichoplax Jan 16, 2023
13fc6cd
Remove space preventing italics from working in link text
trichoplax Jan 16, 2023
6a8d5b7
Replace .com with .org as apitester.com does not exist
trichoplax Jan 16, 2023
7ec63a8
Use apitester.org/app to avoid advert for mobile app
trichoplax Jan 16, 2023
4a90da4
Add missing # in internal link
trichoplax Jan 16, 2023
76c1717
mention ruby 3 in installation instructions
cellio Jan 13, 2023
3b62124
update Ruby version info (since we've moved to Ruby 3 I don't know if…
cellio Jan 13, 2023
04f8b02
Convert 'else if' to 'if' because it depends on data from the previou…
trichoplax Jan 9, 2023
e09675f
Remove check for old preferences schema from over 2 years ago
trichoplax Jan 9, 2023
fbea7cb
Add early return for most frequent case to reduce processing
trichoplax Jan 9, 2023
9c0b57c
Remove null check that is now redundant due to early return
trichoplax Jan 9, 2023
36c7d2b
Improve comment to state local variable contains preferences
trichoplax Jan 10, 2023
532f394
Reject only null & undefined, rather than all falsy local preferences
trichoplax Jan 10, 2023
2d1b3c4
Remove 'if' block made redundant by early returns
trichoplax Jan 10, 2023
41f888a
Store preferences on QPixel rather than window ('this')
trichoplax Jan 10, 2023
8775594
Suppress preferences retrieval when user is not signed in
trichoplax Jan 10, 2023
41431c2
Extract duplicated localStorage preferences code into a function
trichoplax Jan 11, 2023
c247bc8
Use unique localStorage key per user to avoid corruption
trichoplax Jan 11, 2023
963607f
Make 'if' explicit and include mandatory braces for code standards
trichoplax Jan 11, 2023
3b5ab24
Add the commas I forgot between new functions in QPixel object
trichoplax Jan 11, 2023
d2ea865
Change preference function to use early return
trichoplax Jan 11, 2023
3ea48a7
Extract common code into separate functions
trichoplax Jan 12, 2023
bde36fa
Add JavaScript documentation comments for new functions
trichoplax Jan 12, 2023
a6cb525
search results count added
duncanscode Jan 19, 2023
adcef28
Removed cateogry-meta
duncanscode Jan 20, 2023
793ea25
Bump globalid from 1.0.0 to 1.0.1
dependabot[bot] Jan 19, 2023
c1c0679
Add user id and signed in status to HTML body to avoid requests
trichoplax Jan 20, 2023
06760e8
Check signed in status on HTML body rather than making a request
trichoplax Jan 20, 2023
d2bebee
Access user id from HTML body rather than making a request
trichoplax Jan 20, 2023
4fd2a9d
Prevent request for user data unless there is a signed in user
trichoplax Jan 20, 2023
a364bcf
Use HTML data attribute userId instead of redundant signedIn
trichoplax Jan 20, 2023
51bc0cf
Update JS doc comment because function is no longer async
trichoplax Jan 20, 2023
2a4e996
Simplify QPixel._preferencesLocalStorageKey function
trichoplax Jan 20, 2023
0a69483
Bump rack from 2.2.4 to 2.2.6.2
dependabot[bot] Jan 19, 2023
038bcc3
Fix comparisons
Taeir Jan 3, 2023
fabd3e1
Remove unnecessary test
Taeir Jan 3, 2023
98275fe
Ensure tour tagset works with both strings and ints
Taeir Jan 19, 2023
f1998db
Add indicator if there are pending suggested edits
MoshiKoi Jan 3, 2023
66a881f
Cache whether there are pending suggestions
MoshiKoi Jan 3, 2023
e9dcdb6
Move pending logic to helper method
MoshiKoi Jan 3, 2023
1f60b2f
Update app/models/suggested_edit.rb
MoshiKoi Jan 22, 2023
5c4e79b
site -> community
superplane39 Jan 24, 2023
c7e829b
site -> community
superplane39 Jan 24, 2023
46f6f5b
Move check for signed in user from preferences function to preference
trichoplax Jan 22, 2023
d8ba668
Rename function to make clear it is internal only
trichoplax Jan 22, 2023
d029359
Cache '_fetchPreferences' returned promise to avoid redundant fetches
trichoplax Jan 22, 2023
5983d37
Add Stripe setting
ArtOfCode- Jan 30, 2023
5ce193a
Only load Stripe on donation pages
ArtOfCode- Jan 30, 2023
655d810
Add all-users email tool
ArtOfCode- Jan 30, 2023
641ccae
added info about using HTML details/summary (CommonMark doesn't support)
cellio Jan 25, 2023
41b2c66
Bump commonmarker from 0.23.6 to 0.23.7
dependabot[bot] Jan 25, 2023
f699079
Let only moderators (implicitly including admins) see who handled a flag
trichoplax Feb 1, 2023
e6c0193
Add missing indentation
trichoplax Feb 16, 2023
7054876
Fix one line if statement to match Code Standards
trichoplax Feb 16, 2023
5222fd7
Add missing semicolon
trichoplax Feb 16, 2023
8909606
Condense two queries into one for efficiency
trichoplax Feb 16, 2023
c372ba5
Switch 'if' branches to prevent leaking information about post existence
trichoplax Feb 16, 2023
9c4cf5a
Extract private thread checks into a 'before_action'
trichoplax Feb 16, 2023
8af6193
Remove debug printing code
trichoplax Feb 16, 2023
1f0f7ef
Remove comma and surplus 's', reduce number of lines
trichoplax Feb 16, 2023
f98fc8d
Make method name more explicit
trichoplax Feb 16, 2023
7fb8ae9
Improve wording and reduce number of lines
trichoplax Feb 16, 2023
174082c
Drop commas, improve wording, keep to 140 characters per line
trichoplax Feb 16, 2023
ddd4803
Keep to 140 characters per line
trichoplax Feb 16, 2023
d08f4af
Drop commas and keep to 140 characters per line
trichoplax Feb 16, 2023
409ac9d
Remove redundant usages of 'is_admin' covered by 'is_moderator'
trichoplax Feb 16, 2023
c4d05dc
Combine 2 return unless guards into 1 for readability
trichoplax Feb 16, 2023
2c50a2d
Remove unnecessary break in line
trichoplax Feb 16, 2023
96c798e
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Feb 16, 2023
c18fec3
Add missing closing parenthesis
trichoplax Feb 16, 2023
56a3cf6
Update database schema after running database migration for new mod t…
trichoplax Feb 16, 2023
6bcd6ce
Restrict thread followers to only moderators (including admins)
trichoplax Feb 17, 2023
80d3472
Ignore rbenv local file
luap42 Jun 25, 2023
01e910c
Merge branch 'develop' into luap42/moderator-tools-improvements
luap42 Jun 25, 2023
9f45967
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Aug 6, 2023
2f7ed40
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Aug 18, 2023
fd66bc8
Remove 'destroy user' from routes and user interface
trichoplax Aug 29, 2023
fa5e0bc
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Oct 25, 2023
048685b
Remove confusing development-only in joke from fail-ban interface
trichoplax Oct 25, 2023
f157386
Rename mod tools subsection to avoid Codidact-specific naming
trichoplax Oct 25, 2023
2e023fd
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Feb 13, 2024
277c2e7
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Mar 9, 2024
500ca1c
Fix post must exist error preventing sending a mod message
trichoplax Mar 9, 2024
65db2e7
Fix error due to lack of post when displaying moderator comment thread
trichoplax Mar 9, 2024
54e2e16
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Mar 18, 2024
320c578
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax May 11, 2024
5e68ba0
Update schema.rb following migrations
trichoplax May 11, 2024
7505007
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax May 25, 2024
18ba60c
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax May 29, 2024
ffa97d5
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Jun 3, 2024
d271b38
Split user mod tools sections and remove Codidact specific wording
trichoplax Jun 7, 2024
3b225c2
Use 'failban' rather than 'hellban' throughout code for consistency
trichoplax Jun 7, 2024
3f0926c
Style moderator tools tab as active on user profile
trichoplax Jun 7, 2024
a225fbc
Make mod tools Full Activity Log compatible with private comment threads
trichoplax Jun 24, 2024
fd9344b
Make mod tools Global Summary compatible with private comment threads
trichoplax Jun 26, 2024
4f07b2a
Improve wording of user mod tools page intro message
trichoplax Jun 27, 2024
2795ff0
Make impersonate section of user mod tools show correct side panels
trichoplax Jun 27, 2024
2acc08e
Make user mod tools tab remain highlighted when switching sections
trichoplax Jun 27, 2024
07d0088
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Jun 28, 2024
e1934a2
Include link to full thread for private messages
trichoplax Jun 28, 2024
7ecc843
Indicate when a user has no private messages or warnings
trichoplax Jun 28, 2024
b8e71c6
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Jul 5, 2024
c10685a
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Jul 8, 2024
ffa5f99
Remove tests for destroy user functionality that no longer exists
trichoplax Jul 8, 2024
948c139
Remove redundant rubocop disabling
trichoplax Jul 8, 2024
4980181
Use unless instead of if not thanks to rubocop
trichoplax Jul 8, 2024
e40e6de
Remove redundant whitespace
trichoplax Jul 8, 2024
68f8949
Remove duplicate of method
trichoplax Jul 8, 2024
a50dc14
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Jul 9, 2024
cf15160
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Jul 9, 2024
73f6abb
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Jul 23, 2024
96dc8a7
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Aug 29, 2024
61552d1
Fix missing mod messages in List Previous section
trichoplax Sep 1, 2024
973a98d
Remove redundancy from query
trichoplax Sep 1, 2024
85e9b41
Remove redundant safe navigation following explicit nil check
trichoplax Sep 1, 2024
e128a38
Use parentheses for consistency
trichoplax Sep 1, 2024
bfb45b2
Apply Taeir's suggestion from a comment on pull request 1009
trichoplax Sep 1, 2024
fd6a774
Reduce scope of variables no longer used outside method
trichoplax Sep 1, 2024
7947127
Reduce confusing variable reuse and mislabelling
trichoplax Sep 1, 2024
acc3c1c
Make maximum global suspension 1 year, like local suspensions
trichoplax Sep 1, 2024
40b4ce3
Reduce use of .present? for readability
trichoplax Sep 3, 2024
9c3f978
Adjust order and wording of Contact Privately notice
trichoplax Sep 5, 2024
6e781b8
Draw attention to the visibility to moderators of a private message
trichoplax Sep 6, 2024
8543bc7
Allow moderators (and implicitly admins) to view all private messages
trichoplax Sep 6, 2024
2ff6fa3
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Sep 11, 2024
0b2ad8c
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Sep 12, 2024
864c420
Allow notifications on a thread without a parent post
trichoplax Sep 13, 2024
d7b6b9d
Show username at top of private thread to avoid confusion
trichoplax Sep 13, 2024
033c662
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Sep 26, 2024
e1a5220
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Oct 3, 2024
61fadf6
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Oct 7, 2024
441d2ff
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Oct 14, 2024
c988e28
Merge branch 'develop' into luap42/moderator-tools-improvements
cellio Oct 16, 2024
71f62b7
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Oct 20, 2024
a5ab018
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Oct 25, 2024
5f32ee5
Merge branch 'develop' into luap42/moderator-tools-improvements
Oaphi Oct 26, 2024
4f9147d
rubocop fix
Oaphi Oct 26, 2024
5302aee
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Jan 10, 2025
525f6e8
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Jan 15, 2025
5fd65d3
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Jan 28, 2025
fae0628
Merge branch 'develop' into luap42/moderator-tools-improvements
trichoplax Mar 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ qpixel-import.tar.gz

dump.rdb

# Ignore rbenv local file
.ruby-version

# Ignore IRB files
.irbrc
.irb_history
9 changes: 9 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ $(document).on('ready', function() {
});
});

$(".is-partial-only:not(.open)").on("click", (evt) => {
if (evt.target.classList.contains("open")) {
return;
}

evt.target.classList.add("open");
evt.stopPropagation();
});

if (document.cookie.indexOf('dismiss_fvn') === -1 ) {
$('#fvn-dismiss').on('click', () => {
document.cookie = 'dismiss_fvn=true; path=/; expires=Fri, 31 Dec 9999 23:59:59 GMT';
Expand Down
32 changes: 32 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,35 @@ img.header--item-image {
.widget--header-link {
margin: 0 0 0 0.5em;
}


.is-partial-only:not(.open) {
max-height: 100px;
overflow: hidden;
position: relative;

&::after {
content: '';
position: absolute;
right: 0; left: 0;
bottom: 0;
height: 75px;
background-color: rgba(255, 255, 255, 0.5);
background: linear-gradient(#ffffff66, #fffffffa);
z-index: 10000000;
}

&::before {
content: 'expand';
position: absolute;
left: 50%;
transform: translate(-50%);
bottom: 10px;
z-index: 10000001;
padding: 5px 20px;
background-color: #ddd;
border: 1px solid #666;
border-radius: 15px;
cursor: pointer;
}
}
4 changes: 4 additions & 0 deletions app/assets/stylesheets/tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

.tabs {
margin-bottom: 1em;

.tabs--push {
flex-grow: 1;
}
}
16 changes: 16 additions & 0 deletions app/assets/stylesheets/users.scss
Original file line number Diff line number Diff line change
Expand Up @@ -231,3 +231,19 @@ $sizes: (16, 32, 40, 48, 64, 128, 256);
}
}
}


.modtools--sidebar {
margin-right: 1rem;
}
.modtools--usercard {
padding: 0.5rem;
}
.modtools-tbl-noborder {
th {
border-bottom-width: 1px !important;
width: 150px;
}
}

.mod-warnings-clear-form { display: inline; }
5 changes: 3 additions & 2 deletions app/controllers/admin_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
class AdminController < ApplicationController
before_action :verify_admin, except: [:change_back, :verify_elevation]
before_action :verify_global_admin, only: [:admin_email, :send_admin_email, :new_site, :create_site, :setup,
:setup_save, :hellban]
:setup_save, :failban]
before_action :verify_developer, only: [:change_users, :impersonate, :all_email, :send_all_email]

def index; end
Expand Down Expand Up @@ -143,7 +143,7 @@
render
end

def hellban
def failban
@user = User.find params[:id]
@user.block("user manually blocked by admin ##{current_user.id}")
flash[:success] = t 'admin.user_fed_stat'
Expand All @@ -152,6 +152,7 @@

def impersonate
@user = User.find params[:id]
render layout: 'without_sidebar'

Check warning on line 155 in app/controllers/admin_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/admin_controller.rb#L155

Added line #L155 was not covered by tests
end

def change_users
Expand Down
5 changes: 4 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,10 @@ def pull_categories
def check_if_warning_or_suspension_pending
return if current_user.nil?

warning = ModWarning.where(community_user: current_user.community_user, active: true).any?
warning = ModWarning.where(community_user: current_user.community_user)
.or(ModWarning.where(user: current_user, is_global: true))
.where(active: true)
.any?
return unless warning

# Ignore devise and warning routes
Expand Down
52 changes: 37 additions & 15 deletions app/controllers/comments_controller.rb
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Provides mainly web actions for using and making comments.

class CommentsController < ApplicationController
before_action :authenticate_user!, except: [:post, :show, :thread]
before_action :set_comment, only: [:update, :destroy, :undelete, :show]
before_action :set_thread, only: [:thread, :thread_rename, :thread_restrict, :thread_unrestrict, :thread_followers]
before_action :check_privilege, only: [:update, :destroy, :undelete]
before_action :check_if_target_post_locked, only: [:create, :post_follow]
before_action :check_if_parent_post_locked, only: [:update, :destroy]
before_action :check_if_thread_is_private, only: [:update, :destroy, :undelete]
before_action :check_if_not_mod_and_thread_is_private, only: [:thread_rename, :thread_restrict, :thread_unrestrict]

def create_thread
@post = Post.find(params[:post_id])
if @post.comments_disabled && !current_user.is_moderator && !current_user.is_admin
if @post.comments_disabled && !current_user.is_moderator
render json: { status: 'failed', message: 'Comments have been disabled on this post.' }, status: :forbidden
return
elsif !@post.can_access?(current_user)
Expand Down Expand Up @@ -63,11 +66,13 @@
def create
@comment_thread = CommentThread.find(params[:id])
@post = @comment_thread.post
if @post.comments_disabled && !current_user.is_moderator && !current_user.is_admin
render json: { status: 'failed', message: 'Comments have been disabled on this post.' }, status: :forbidden
return
elsif !@post.can_access?(current_user)
return not_found
unless @post.nil?
if !@post.can_access?(current_user)
return not_found
elsif @post.comments_disabled && !current_user.is_moderator
render json: { status: 'failed', message: 'Comments have been disabled on this post.' }, status: :forbidden
return
end
end

body = params[:content]
Expand All @@ -89,10 +94,13 @@
.where('link LIKE ?', "#{thread_url}%")
next if existing_notification.exists?

title = @post.parent.nil? ? @post.title : @post.parent.title
follower.user.create_notification("There are new comments in a followed thread '#{@comment_thread.title}' " \
"on the post '#{title}'",
helpers.comment_link(@comment))
if @post.nil?
wording = "There are new comments in a private thread '#{@comment_thread.title}'"

Check warning on line 98 in app/controllers/comments_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/comments_controller.rb#L98

Added line #L98 was not covered by tests
else
post_title = @post.parent.nil? ? @post.title : @post.parent.title
wording = "There are new comments in a followed thread '#{@comment_thread.title}' on the post '#{post_title}'"
end
follower.user.create_notification(wording, helpers.comment_link(@comment))
end
else
flash[:danger] = @comment.errors.full_messages.join(', ')
Expand Down Expand Up @@ -161,8 +169,7 @@
end

def thread_followers
return not_found unless @comment_thread.can_access?(current_user)
return not_found unless current_user.is_moderator || current_user.is_admin
return not_found unless current_user.is_moderator

@followers = ThreadFollower.where(comment_thread: @comment_thread).joins(:user, user: :community_user)
.includes(:user, user: [:community_user, :avatar_attachment])
Expand Down Expand Up @@ -292,7 +299,7 @@
end

def check_privilege
unless current_user.is_moderator || current_user.is_admin || current_user == @comment.user
unless current_user.is_moderator || current_user == @comment.user
render template: 'errors/forbidden', status: :forbidden
end
end
Expand All @@ -302,7 +309,7 @@
end

def check_if_target_post_locked
check_if_locked(Post.find(params[:post_id]))
params[:post_id].present? && check_if_locked(Post.find(params[:post_id]))
end

def check_for_pings(thread, content)
Expand All @@ -326,12 +333,14 @@
end

def comment_rate_limited
return false if @comment_thread&.is_private

recent_comments = Comment.where(created_at: 24.hours.ago..DateTime.now, user: current_user).where \
.not(post: Post.includes(:parent).where(parents_posts: { user_id: current_user.id })) \
.where.not(post: Post.where(user_id: current_user.id)).count
max_comments_per_day = SiteSetting[current_user.privilege?('unrestricted') ? 'RL_Comments' : 'RL_NewUserComments']

if (!@post.user_id == current_user.id || @post&.parent&.user_id == current_user.id) \
if (!@post&.user_id == current_user.id || @post&.parent&.user_id == current_user.id) \
&& recent_comments >= max_comments_per_day
comment_limit_msg = "You have used your daily comment limit of #{recent_comments} comments. " \
'Come back tomorrow to continue commenting. Comments on own posts and on answers ' \
Expand All @@ -349,4 +358,17 @@
end
false
end

def check_if_thread_is_private
if @comment_thread&.is_private
flash[:danger] = 'This action is not permitted.'
redirect_to comment_thread_path(@comment_thread.id)

Check warning on line 365 in app/controllers/comments_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/comments_controller.rb#L364-L365

Added lines #L364 - L365 were not covered by tests
end
end

def check_if_not_mod_and_thread_is_private
unless current_user.is_moderator
check_if_thread_is_private
end
end
end
68 changes: 61 additions & 7 deletions app/controllers/mod_warning_controller.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
class ModWarningController < ApplicationController
before_action :verify_moderator, only: [:log, :new, :create, :lift]
before_action :verify_global_moderator, only: [:new_global, :create_global]

before_action :set_warning, only: [:current, :approve]
before_action :set_user, only: [:log, :new, :create, :lift]
before_action :set_user, only: [:log, :new, :create, :lift, :new_global, :create_global]

def current
render layout: 'without_sidebar'
Expand All @@ -21,7 +22,20 @@
end

def log
@warnings = ModWarning.where(community_user: @user.community_user).order(created_at: :desc).all
warnings = ModWarning.where(community_user: @user.community_user)
if current_user.is_global_moderator || current_user.is_global_admin
warnings = warnings.or(ModWarning.where(user: @user, is_global: true))

Check warning on line 27 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L25-L27

Added lines #L25 - L27 were not covered by tests
end
warnings = warnings.all
.map { |w| { type: :warning, value: w } }

Check warning on line 30 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L29-L30

Added lines #L29 - L30 were not covered by tests

user_followed_threads = ThreadFollower.where(user: @user).select(:comment_thread_id)
messages = CommentThread.where(post: nil, is_private: true, id: user_followed_threads)

Check warning on line 33 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L32-L33

Added lines #L32 - L33 were not covered by tests
.all
.filter { |m| m.comments.first.user&.id != @user&.id }
.map { |m| { type: :message, value: m } }

Check warning on line 36 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L35-L36

Added lines #L35 - L36 were not covered by tests

@entries = (warnings + messages).sort_by { |e| e[:value].created_at }.reverse

Check warning on line 38 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L38

Added line #L38 was not covered by tests
render layout: 'without_sidebar'
end

Expand All @@ -44,25 +58,64 @@

@warning = ModWarning.new(author: current_user, community_user: @user.community_user,
body: params[:mod_warning][:body], is_suspension: is_suspension,
suspension_end: suspension_end, active: true, read: false)
suspension_end: suspension_end, active: true, read: false,
is_global: false)
if @warning.save
if is_suspension
@user.community_user.update(is_suspended: is_suspension, suspension_end: suspension_end,
suspension_public_comment: params[:mod_warning][:suspension_public_notice])
end

redirect_to user_path(@user)
redirect_to mod_user_path(@user)

Check warning on line 69 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L69

Added line #L69 was not covered by tests
else
render :new

Check warning on line 71 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L71

Added line #L71 was not covered by tests
end
end

def new_global
@warning = ModWarning.new(author: current_user, is_suspension: true)
render layout: 'without_sidebar'

Check warning on line 77 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L76-L77

Added lines #L76 - L77 were not covered by tests
end

def create_global
suspension_duration = params[:mod_warning][:suspension_duration].to_i

Check warning on line 81 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L81

Added line #L81 was not covered by tests

suspension_duration = 1 if suspension_duration <= 0
suspension_duration = 365 if suspension_duration > 365

Check warning on line 84 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L83-L84

Added lines #L83 - L84 were not covered by tests

suspension_end = DateTime.now + suspension_duration.days

Check warning on line 86 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L86

Added line #L86 was not covered by tests

@warning = ModWarning.new(author: current_user, user: @user,

Check warning on line 88 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L88

Added line #L88 was not covered by tests
body: params[:mod_warning][:body], is_suspension: true,
suspension_end: suspension_end, active: true, read: false,
is_global: true)
if @warning.save
@user.update(is_globally_suspended: true, global_suspension_end: suspension_end)

Check warning on line 93 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L92-L93

Added lines #L92 - L93 were not covered by tests

redirect_to mod_user_path(@user)

Check warning on line 95 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L95

Added line #L95 was not covered by tests
else
render :new
end
end

def lift
@warning = ModWarning.where(community_user: @user.community_user, active: true).last
@warning = ModWarning.where(user: @user, is_global: true, active: true).last
@warning ||= ModWarning.where(community_user: @user.community_user, active: true).last

Check warning on line 103 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L102-L103

Added lines #L102 - L103 were not covered by tests
return not_found if @warning.nil?

if @warning.is_global && !current_user.is_global_moderator && !current_user.is_global_admin
flash[:error] = 'A network-wide suspension has been applied which may only be lifted by global moderators. ' \

Check warning on line 107 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L106-L107

Added lines #L106 - L107 were not covered by tests
'Community-wide suspensions which have been imposed before that global suspension cannot be ' \
'lifted at this time (which is probably why you are seeing this error).'
redirect_to mod_warning_log_path(@user)

Check warning on line 110 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L110

Added line #L110 was not covered by tests
end

@warning.update(active: false, read: false)
@user.community_user.update is_suspended: false, suspension_public_comment: nil, suspension_end: nil
if @warning.is_global
@user.update is_globally_suspended: false, global_suspension_end: nil

Check warning on line 115 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L114-L115

Added lines #L114 - L115 were not covered by tests
else
@user.community_user.update is_suspended: false, suspension_public_comment: nil, suspension_end: nil

Check warning on line 117 in app/controllers/mod_warning_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/mod_warning_controller.rb#L117

Added line #L117 was not covered by tests
end

AuditLog.moderator_audit(event_type: 'warning_lift', related: @warning, user: current_user,
comment: "<<Warning #{@warning.attributes_print} >>")
Expand All @@ -75,7 +128,8 @@
private

def set_warning
@warning = ModWarning.where(community_user: current_user.community_user, active: true).last
@warning = ModWarning.where(user: current_user, active: true, is_global: true).last
@warning ||= ModWarning.where(community_user: current_user.community_user, active: true).last
not_found if @warning.nil?
end

Expand Down
1 change: 1 addition & 0 deletions app/controllers/moderator_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
total: Vote.where(recv_user: @user).count
)
)
render layout: 'without_sidebar'

Check warning on line 70 in app/controllers/moderator_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/moderator_controller.rb#L70

Added line #L70 was not covered by tests
end

private
Expand Down
Loading
Loading