Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce the activity table #1173

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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 .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ S3_VERSION=
# Only let admins generated oauth clients
KBIN_ADMIN_ONLY_OAUTH_CLIENTS=false

# Manually approve every new user
MBIN_NEW_USERS_NEED_APPROVAL=false

# oAuth (optional)
OAUTH_AZURE_ID=
OAUTH_AZURE_SECRET=
Expand Down
3 changes: 3 additions & 0 deletions .env.example_docker
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ S3_VERSION=
# Only let admins generate oauth clients
KBIN_ADMIN_ONLY_OAUTH_CLIENTS=false

# Manually approve every new user
MBIN_NEW_USERS_NEED_APPROVAL=false

# oAuth (optional)
OAUTH_AZURE_ID=
OAUTH_AZURE_SECRET=
Expand Down
40 changes: 40 additions & 0 deletions assets/controllers/subject_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,46 @@ export default class extends Controller {
}
}

/**
* Calls the address attached to the nearest link node. Replaces the outer html of the nearest `cssclass` parameter
* with the response from the link
*/
async linkCallback(event) {
const { cssclass: cssClass, refreshlink: refreshLink, refreshselector: refreshSelector } = event.params
event.preventDefault();

const a = event.target.closest('a');

try {
this.loadingValue = true;

let response = await fetch(a.href, {
method: 'GET',
});

response = await ok(response);
response = await response.json();

event.target.closest(`.${cssClass}`).outerHTML = response.html;

const refreshElement = this.element.querySelector(refreshSelector)
console.log("linkCallback refresh stuff", refreshLink, refreshSelector, refreshElement)

if (!!refreshLink && refreshLink !== "" && !!refreshElement) {
let response = await fetch(refreshLink, {
method: 'GET',
});

response = await ok(response);
response = await response.json();
refreshElement.outerHTML = response.html;
}
} catch (e) {
} finally {
this.loadingValue = false;
}
}

loadingValueChanged(val) {
const submitButton = this.containerTarget.querySelector('form button[type="submit"]');

Expand Down
4 changes: 4 additions & 0 deletions assets/styles/app.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@use '@fortawesome/fontawesome-free/scss/fontawesome';
@use '@fortawesome/fontawesome-free/scss/solid';
@use '@fortawesome/fontawesome-free/scss/regular';
@use '@fortawesome/fontawesome-free/scss/brands';
@use 'simple-icons-font/font/simple-icons';
@use 'variables';
Expand All @@ -14,6 +15,7 @@
@use 'layout/alerts';
@use 'layout/forms';
@use 'layout/images';
@use 'layout/icons';
@use 'components/announcement';
@use 'components/topbar';
@use 'components/header';
Expand All @@ -28,6 +30,7 @@
@use 'components/figure_image';
@use 'components/figure_lightbox';
@use 'components/post';
@use 'components/search';
@use 'components/subject';
@use 'components/login';
@use 'components/modlog';
Expand All @@ -44,6 +47,7 @@
@use 'components/settings_row';
@use 'pages/post_single';
@use 'pages/post_front';
@use 'pages/page_bookmarks';
@use 'themes/kbin';
@use 'themes/default';
@use 'themes/solarized';
Expand Down
24 changes: 24 additions & 0 deletions assets/styles/components/_search.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.search-container {
background: var(--kbin-input-bg);
border: var(--kbin-input-border);
border-radius: var(--kbin-rounded-edges-radius) !important;

input.form-control {
border-radius: 0 !important;
border: none;
background: transparent;
margin: 0 .5em;
padding: .5rem .25rem;
}

button {
border-radius: 0 var(--kbin-rounded-edges-radius) var(--kbin-rounded-edges-radius) 0 !important;
border: 0;
padding: 1rem 0.5rem;

&:not(:hover) {
background: var(--kbin-input-bg);
color: var(--kbin-input-text-color) !important;
}
}
}
12 changes: 11 additions & 1 deletion assets/styles/layout/_forms.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@use 'breakpoints' as b;
@use '../mixins/mbin';
@use '@fortawesome/fontawesome-free/scss/fontawesome' as fa;

.btn {
font-size: .85rem;
Expand Down Expand Up @@ -125,9 +126,12 @@ input[type=radio] {
align-content: center;
cursor: pointer;

@extend %fa-icon;
@extend .fa-solid;

&::before {
font-family: var(--kbin-font-awesome-font-family);
content: "\f00c";
content: fa.fa-content(fa.$fa-var-check);
transform: scale(0);
transition: 100ms transform ease-in;
}
Expand Down Expand Up @@ -528,3 +532,9 @@ div.input-box {
border-radius: var(--kbin-rounded-edges-radius) !important;
}
}

.form-control {
display: block;
width: 100%;

}
3 changes: 3 additions & 0 deletions assets/styles/layout/_icons.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
i.active {
color: var(--kbin-color-icon-active, orange);
}
10 changes: 9 additions & 1 deletion assets/styles/layout/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,9 @@ figure {
code,
.ts-control > [data-value].item,
.image-preview-container {
border-radius: var(--kbin-rounded-edges-radius) !important;
&:not(.ignore-edges) {
border-radius: var(--kbin-rounded-edges-radius) !important;
}
}

.ts-wrapper {
Expand Down Expand Up @@ -363,6 +365,12 @@ figure {
gap: .25rem;
}

@include b.media-breakpoint-down(lg) {
.flex.mobile {
display: block;
}
}

.flex-wrap {
flex-wrap: wrap;
}
Expand Down
8 changes: 0 additions & 8 deletions assets/styles/layout/_section.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,3 @@
color: var(--kbin-alert-danger-text-color);
}
}

.page-search {
.section--top {
button {
padding: 1rem 1.5rem;
}
}
}
6 changes: 6 additions & 0 deletions assets/styles/pages/page_bookmarks.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.page-bookmarks {
.entry, .entry-comment, .post, .post-comment, .comment {
margin-top: 0!important;
margin-bottom: .5em!important;
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
"twig/extra-bundle": "^3.10.0",
"twig/html-extra": "^3.10.0",
"twig/intl-extra": "^3.10.0",
"twig/twig": "^3.10.3",
"twig/twig": "^3.15.0",
"webmozart/assert": "^1.11.0",
"wohali/oauth2-discord-new": "^1.2.1"
},
Expand Down
6 changes: 3 additions & 3 deletions composer.lock

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

15 changes: 15 additions & 0 deletions config/mbin_routes/admin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ admin_magazine_ownership_requests_reject:
path: /admin/magazine_ownership/{name}/{username}/reject
methods: [POST]

admin_signup_requests:
controller: App\Controller\Admin\AdminSignupRequestsController::requests
path: /admin/signup_requests
methods: [ GET ]

admin_signup_requests_approve:
controller: App\Controller\Admin\AdminSignupRequestsController::approve
path: /admin/signup_requests/{id}/approve
methods: [ POST ]

admin_signup_requests_reject:
controller: App\Controller\Admin\AdminSignupRequestsController::reject
path: /admin/signup_requests/{id}/reject
methods: [ POST ]

admin_cc:
controller: App\Controller\Admin\AdminClearCacheController
path: /admin/cc
Expand Down
18 changes: 18 additions & 0 deletions config/mbin_routes/admin_api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,21 @@ api_admin_purge_magazine:
path: /api/admin/magazine/{magazine_id}/purge
methods: [ DELETE ]
format: json

api_admin_view_user_applications:
controller: App\Controller\Api\User\Admin\UserApplicationApi::retrieve
path: /api/admin/users/applications
methods: [ GET ]
format: json

api_admin_view_user_application_approve:
controller: App\Controller\Api\User\Admin\UserApplicationApi::approve
path: /api/admin/users/applications/{user_id}/approve
methods: [ GET ]
format: json

api_admin_view_user_application_reject:
controller: App\Controller\Api\User\Admin\UserApplicationApi::reject
path: /api/admin/users/applications/{user_id}/reject
methods: [ GET ]
format: json
71 changes: 71 additions & 0 deletions config/mbin_routes/bookmark.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
bookmark_front:
controller: App\Controller\BookmarkListController::front
defaults: { sortBy: hot, time: '∞', federation: all }
path: /bookmark-lists/show/{list}/{sortBy}/{time}/{federation}
methods: [GET]
requirements: &front_requirement
sortBy: "%default_sort_options%"
time: "%default_time_options%"
federation: "%default_federation_options%"

bookmark_lists:
controller: App\Controller\BookmarkListController::list
path: /bookmark-lists
methods: [GET, POST]

bookmark_lists_menu_refresh_status:
controller: App\Controller\BookmarkListController::subjectBookmarkMenuListRefresh
path: /blr/{subject_id}/{subject_type}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]

bookmark_lists_make_default:
controller: App\Controller\BookmarkListController::makeDefault
path: /bookmark-lists/makeDefault
methods: [GET]

bookmark_lists_edit_list:
controller: App\Controller\BookmarkListController::editList
path: /bookmark-lists/editList/{list}
methods: [GET, POST]

bookmark_lists_delete_list:
controller: App\Controller\BookmarkListController::deleteList
path: /bookmark-lists/deleteList/{list}
methods: [GET]

subject_bookmark_standard:
controller: App\Controller\BookmarkController::subjectBookmarkStandard
path: /bos/{subject_id}/{subject_type}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]

subject_bookmark_refresh_status:
controller: App\Controller\BookmarkController::subjectBookmarkRefresh
path: /bor/{subject_id}/{subject_type}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]

subject_bookmark_to_list:
controller: App\Controller\BookmarkController::subjectBookmarkToList
path: /bol/{subject_id}/{subject_type}/{list}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]

subject_remove_bookmarks:
controller: App\Controller\BookmarkController::subjectRemoveBookmarks
path: /rbo/{subject_id}/{subject_type}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]

subject_remove_bookmark_from_list:
controller: App\Controller\BookmarkController::subjectRemoveBookmarkFromList
path: /rbol/{subject_id}/{subject_type}/{list}
requirements:
subject_type: "%default_subject_type_options%"
methods: [ GET ]
Loading
Loading