mirror of
https://github.com/flarum/core.git
synced 2025-08-20 23:31:27 +02:00
Compare commits
3 Commits
as/monorep
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
5c901cfba8 | ||
|
be1b5713fa | ||
|
5045254c9f |
@@ -1,6 +1,5 @@
|
|||||||
import type Mithril from 'mithril';
|
import type Mithril from 'mithril';
|
||||||
import Component, { ComponentAttrs } from '../Component';
|
import Component, { ComponentAttrs } from '../Component';
|
||||||
export default class ColorPreviewInput extends Component {
|
export default class ColorPreviewInput extends Component {
|
||||||
value?: string;
|
|
||||||
view(vnode: Mithril.Vnode<ComponentAttrs, this>): JSX.Element;
|
view(vnode: Mithril.Vnode<ComponentAttrs, this>): JSX.Element;
|
||||||
}
|
}
|
||||||
|
2
js/dist/admin.js
generated
vendored
2
js/dist/admin.js
generated
vendored
File diff suppressed because one or more lines are too long
2
js/dist/admin.js.map
generated
vendored
2
js/dist/admin.js.map
generated
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum.js
generated
vendored
2
js/dist/forum.js
generated
vendored
File diff suppressed because one or more lines are too long
2
js/dist/forum.js.map
generated
vendored
2
js/dist/forum.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -5,23 +5,20 @@ import classList from '../utils/classList';
|
|||||||
import icon from '../helpers/icon';
|
import icon from '../helpers/icon';
|
||||||
|
|
||||||
export default class ColorPreviewInput extends Component {
|
export default class ColorPreviewInput extends Component {
|
||||||
value?: string;
|
|
||||||
|
|
||||||
view(vnode: Mithril.Vnode<ComponentAttrs, this>) {
|
view(vnode: Mithril.Vnode<ComponentAttrs, this>) {
|
||||||
const { className, ...attrs } = this.attrs;
|
const { className, id, ...attrs } = this.attrs;
|
||||||
const value = attrs.bidi?.() || attrs.value;
|
|
||||||
|
|
||||||
attrs.type ||= 'text';
|
attrs.type ||= 'text';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="ColorInput">
|
<div className="ColorInput">
|
||||||
<input className={classList('FormControl', className)} {...attrs} />
|
<input className={classList('FormControl', className)} id={id} {...attrs} />
|
||||||
|
|
||||||
<span className="ColorInput-icon" role="presentation">
|
<span className="ColorInput-icon" role="presentation">
|
||||||
{icon('fas fa-exclamation-circle')}
|
{icon('fas fa-exclamation-circle')}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<div className="ColorInput-preview" style={{ '--input-value': value }} role="presentation" />
|
<input className="ColorInput-preview" {...attrs} type="color" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -7,12 +7,26 @@
|
|||||||
bottom: 8px;
|
bottom: 8px;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
pointer-events: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
&-preview {
|
&-preview {
|
||||||
background-color: var(--input-value);
|
display: inline-block;
|
||||||
border-radius: 15%;
|
border-radius: 15%;
|
||||||
|
padding: 0;
|
||||||
|
cursor: pointer;
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
// Match both the wrapper div and the div with the background color
|
||||||
|
&, &::-webkit-color-swatch-wrapper, &::-webkit-color-swatch {
|
||||||
|
border: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This has to be a separate entry so other browsers
|
||||||
|
// don't ignore the entire CSS rule. Thanks Firefox.
|
||||||
|
&::-moz-color-swatch {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&-icon {
|
&-icon {
|
||||||
|
@@ -42,16 +42,29 @@ class DiscussionRepository
|
|||||||
/**
|
/**
|
||||||
* Get the IDs of discussions which a user has read completely.
|
* Get the IDs of discussions which a user has read completely.
|
||||||
*
|
*
|
||||||
|
* @deprecated 1.3 Use `getReadIdsQuery` instead
|
||||||
|
*
|
||||||
* @param User $user
|
* @param User $user
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getReadIds(User $user)
|
public function getReadIds(User $user)
|
||||||
|
{
|
||||||
|
return $this->getReadIdsQuery($user)
|
||||||
|
->all();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a query containing the IDs of discussions which a user has read completely.
|
||||||
|
*
|
||||||
|
* @param User $user
|
||||||
|
* @return Builder
|
||||||
|
*/
|
||||||
|
public function getReadIdsQuery(User $user): Builder
|
||||||
{
|
{
|
||||||
return Discussion::leftJoin('discussion_user', 'discussion_user.discussion_id', '=', 'discussions.id')
|
return Discussion::leftJoin('discussion_user', 'discussion_user.discussion_id', '=', 'discussions.id')
|
||||||
->where('discussion_user.user_id', $user->id)
|
->where('discussion_user.user_id', $user->id)
|
||||||
->whereColumn('last_read_post_number', '>=', 'last_post_number')
|
->whereColumn('last_read_post_number', '>=', 'last_post_number')
|
||||||
->pluck('id')
|
->select('id');
|
||||||
->all();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -61,7 +61,7 @@ class UnreadFilterGambit extends AbstractRegexGambit implements FilterInterface
|
|||||||
protected function constrain(Builder $query, User $actor, bool $negate)
|
protected function constrain(Builder $query, User $actor, bool $negate)
|
||||||
{
|
{
|
||||||
if ($actor->exists) {
|
if ($actor->exists) {
|
||||||
$readIds = $this->discussions->getReadIds($actor);
|
$readIds = $this->discussions->getReadIdsQuery($actor);
|
||||||
|
|
||||||
$query->where(function ($query) use ($readIds, $negate, $actor) {
|
$query->where(function ($query) use ($readIds, $negate, $actor) {
|
||||||
if (! $negate) {
|
if (! $negate) {
|
||||||
|
Reference in New Issue
Block a user