-
-
Notifications
You must be signed in to change notification settings - Fork 835
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch '2.x' into dev-search-drivers
# Conflicts: # framework/core/src/Settings/SettingsServiceProvider.php
- Loading branch information
Showing
324 changed files
with
3,959 additions
and
2,413 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 9 additions & 5 deletions
14
extensions/flags/js/dist-typings/forum/components/FlagList.d.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
17 changes: 11 additions & 6 deletions
17
extensions/flags/js/dist-typings/forum/components/FlagsDropdown.d.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
15 changes: 7 additions & 8 deletions
15
extensions/flags/js/dist-typings/forum/states/FlagListState.d.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import app from 'flarum/forum/app'; | ||
import Component from 'flarum/common/Component'; | ||
import type { ComponentAttrs } from 'flarum/common/Component'; | ||
import Avatar from 'flarum/common/components/Avatar'; | ||
import username from 'flarum/common/helpers/username'; | ||
import HeaderList from 'flarum/forum/components/HeaderList'; | ||
import HeaderListItem from 'flarum/forum/components/HeaderListItem'; | ||
import type Mithril from 'mithril'; | ||
import type Post from 'flarum/common/models/Post'; | ||
import type FlagListState from '../states/FlagListState'; | ||
|
||
export interface IFlagListAttrs extends ComponentAttrs { | ||
state: FlagListState; | ||
} | ||
|
||
export default class FlagList<CustomAttrs extends IFlagListAttrs = IFlagListAttrs> extends Component<CustomAttrs, FlagListState> { | ||
oninit(vnode: Mithril.Vnode<CustomAttrs, this>) { | ||
super.oninit(vnode); | ||
this.state = this.attrs.state; | ||
} | ||
|
||
view() { | ||
const flags = this.state.cache || []; | ||
|
||
return ( | ||
<HeaderList | ||
className="FlagList" | ||
title={app.translator.trans('flarum-flags.forum.flagged_posts.title')} | ||
hasItems={flags.length} | ||
loading={this.state.loading} | ||
emptyText={app.translator.trans('flarum-flags.forum.flagged_posts.empty_text')} | ||
> | ||
<ul className="HeaderListGroup-content"> | ||
{!this.state.loading && | ||
flags.map((flag) => { | ||
const post = flag.post() as Post; | ||
|
||
return ( | ||
<li> | ||
<HeaderListItem | ||
className="Flag" | ||
avatar={<Avatar user={post.user() || null} />} | ||
icon="fas fa-flag" | ||
content={app.translator.trans('flarum-flags.forum.flagged_posts.item_text', { | ||
username: username(post.user()), | ||
em: <em />, | ||
discussion: post.discussion().title(), | ||
})} | ||
excerpt={post.contentPlain()} | ||
datetime={flag.createdAt()} | ||
href={app.route.post(post)} | ||
onclick={(e: MouseEvent) => { | ||
app.flags.index = post; | ||
e.redraw = false; | ||
}} | ||
/> | ||
</li> | ||
); | ||
})} | ||
</ul> | ||
</HeaderList> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
extensions/flags/js/src/forum/components/FlagsDropdown.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import app from 'flarum/forum/app'; | ||
import HeaderDropdown from 'flarum/forum/components/HeaderDropdown'; | ||
import type { IHeaderDropdownAttrs } from 'flarum/forum/components/HeaderDropdown'; | ||
import classList from 'flarum/common/utils/classList'; | ||
|
||
import FlagList from './FlagList'; | ||
|
||
export interface IFlagsDropdownAttrs extends IHeaderDropdownAttrs {} | ||
|
||
export default class FlagsDropdown<CustomAttrs extends IFlagsDropdownAttrs = IFlagsDropdownAttrs> extends HeaderDropdown<CustomAttrs> { | ||
static initAttrs(attrs: IFlagsDropdownAttrs) { | ||
attrs.className = classList('FlagsDropdown', attrs.className); | ||
attrs.label = attrs.label || app.translator.trans('flarum-flags.forum.flagged_posts.tooltip'); | ||
attrs.icon = attrs.icon || 'fas fa-flag'; | ||
|
||
super.initAttrs(attrs); | ||
} | ||
|
||
getContent() { | ||
return <FlagList state={this.attrs.state} />; | ||
} | ||
|
||
goToRoute() { | ||
m.route.set(app.route('flags')); | ||
} | ||
|
||
getUnreadCount() { | ||
return app.flags.cache ? app.flags.cache.length : app.forum.attribute<number>('flagCount'); | ||
} | ||
|
||
getNewCount() { | ||
return app.session.user!.attribute<number>('newFlagCount'); | ||
} | ||
} |
Oops, something went wrong.