1
0
mirror of https://github.com/flarum/core.git synced 2025-08-18 22:31:32 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
flarum-bot
5c901cfba8 Bundled output for commit be1b5713fa
Includes transpiled JS/TS, and Typescript declaration files (typings).

[skip ci]
2022-03-10 01:00:54 +00:00
David Sevilla Martin
be1b5713fa Replace ColorPreviewInput preview box with 'color' input (#3271) 2022-03-09 19:56:25 -05:00
Ian Morland
5045254c9f fix: unread filter gambit does not return results when > 999 read discussions for a user (#3295) 2022-03-09 15:41:04 -05:00
9 changed files with 39 additions and 16 deletions

View File

@@ -1,6 +1,5 @@
import type Mithril from 'mithril';
import Component, { ComponentAttrs } from '../Component';
export default class ColorPreviewInput extends Component {
value?: string;
view(vnode: Mithril.Vnode<ComponentAttrs, this>): JSX.Element;
}

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

File diff suppressed because one or more lines are too long

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

File diff suppressed because one or more lines are too long

View File

@@ -5,23 +5,20 @@ import classList from '../utils/classList';
import icon from '../helpers/icon';
export default class ColorPreviewInput extends Component {
value?: string;
view(vnode: Mithril.Vnode<ComponentAttrs, this>) {
const { className, ...attrs } = this.attrs;
const value = attrs.bidi?.() || attrs.value;
const { className, id, ...attrs } = this.attrs;
attrs.type ||= 'text';
return (
<div className="ColorInput">
<input className={classList('FormControl', className)} {...attrs} />
<input className={classList('FormControl', className)} id={id} {...attrs} />
<span className="ColorInput-icon" role="presentation">
{icon('fas fa-exclamation-circle')}
</span>
<div className="ColorInput-preview" style={{ '--input-value': value }} role="presentation" />
<input className="ColorInput-preview" {...attrs} type="color" />
</div>
);
}

View File

@@ -7,12 +7,26 @@
bottom: 8px;
width: 20px;
height: 20px;
pointer-events: none;
}
&-preview {
background-color: var(--input-value);
display: inline-block;
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 {

View File

@@ -42,16 +42,29 @@ class DiscussionRepository
/**
* Get the IDs of discussions which a user has read completely.
*
* @deprecated 1.3 Use `getReadIdsQuery` instead
*
* @param User $user
* @return array
*/
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')
->where('discussion_user.user_id', $user->id)
->whereColumn('last_read_post_number', '>=', 'last_post_number')
->pluck('id')
->all();
->select('id');
}
/**

View File

@@ -61,7 +61,7 @@ class UnreadFilterGambit extends AbstractRegexGambit implements FilterInterface
protected function constrain(Builder $query, User $actor, bool $negate)
{
if ($actor->exists) {
$readIds = $this->discussions->getReadIds($actor);
$readIds = $this->discussions->getReadIdsQuery($actor);
$query->where(function ($query) use ($readIds, $negate, $actor) {
if (! $negate) {