* fix(mentions): mentions XHR fired even after mentioning is done
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* chore: simplify diff
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
---------
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* feat: add tag search
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* feat(mentions): tag mentions backend
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* feat: tag mention design
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* refactor: revamp mentions autocomplete
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* fix: unauthorized mention of hidden groups
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* feat(mentions,tags): use hash format for tag mentions
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* refactor: frontend mention format API with mentionable models
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* feat: implement tag search on the frontend
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* fix: tag color contrast
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* fix: tag suggestions styling
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* test: works with disabled tags extension
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* chore: move `MentionFormats` to `formats`
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* fix: mentions preview bad styling
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* docs: further migration location clarification
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* Apply fixes from StyleCI
* fix: bad test namespace
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* fix: phpstan
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* fix: conditionally add tag related extenders
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* Apply fixes from StyleCI
* feat(phpstan): evaluate conditional extenders
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* feat: use mithril routing for tag mentions
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
---------
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
* perf(core,mentions): limit `mentionedBy` post relation results
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* Apply fixes from StyleCI
* chore: use a static property to allow customization
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* chore: use a static property to allow customization
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* chore: include count in show post endpoint
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* chore: consistent locale key format
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* chore: forgot to delete `FilterVisiblePosts`
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* test: `mentionedByCount` must not include invisible posts to actor
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* fix: visibility scoping on `mentionedByCount`
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* fix: `loadAggregates` conflicts with visibility scopers
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* Apply fixes from StyleCI
* chore: phpstan
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* perf(likes): limit `likes` relationship results
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* Apply fixes from StyleCI
* chore: simplify
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* test: `likesCount` is as expected
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* Apply fixes from StyleCI
---------
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: IanM <16573496+imorland@users.noreply.github.com>
* perf(core,mentions): limit `mentionedBy` post relation results
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* Apply fixes from StyleCI
* chore: use a static property to allow customization
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* chore: use a static property to allow customization
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* chore: include count in show post endpoint
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* chore: consistent locale key format
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* chore: forgot to delete `FilterVisiblePosts`
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* test: `mentionedByCount` must not include invisible posts to actor
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* fix: visibility scoping on `mentionedByCount`
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* fix: `loadAggregates` conflicts with visibility scopers
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* Apply fixes from StyleCI
* chore: phpstan
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
---------
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
* feat(seo): shift h1 tag from logo to discussion title
Many times have we seen opponents of using h2 as the discussion title. Although
my own SEO knowledge is limited, I have seen the importance of structuring pages
according to the content you wish to prioritize. If we only take that into consideration
there is zero reason for the app-wide identical logo to take precedence over any
other heading.
This change makes the logo a standard (visually identical) element, and
makes the discussion hero title a h1.
* feat(seo): rewrite remainder of hero titles and subtitles
* chore: improve group mentions color handling
* Avoid storing the `GroupMention--dark` and light classes on the database.
* Avoid recreating YIQ logic on the backend.
* Improve text color flexibility through CSS variables.
* Apply fixes from StyleCI
* chore: tweak tests
* chre: unused import
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
e.g. This allows you to
`/api/posts?sort=-createdAt&filter[tag]=14` to include tag 14 and `/api/posts?sort=-createdAt&filter[tag]=-14` to exclude tag 14
* add yiq calculator util
* use the new contast util to differentiate light/dark tags
* fix: invert logic
* feat: add tag-dark and tag-light less config
* fix: convert 3 chars hex to 6 chars hex
* fix: rename import
* fix: clarify util name
* fix: rename function
* fix: invert less variables when dark mode is enabled
* fix: TagTiles contrast
* refactor: simplify logic with a unique variable
* refactor: simplify logic with a unique variable
* feat: add text color variables not depending on the dark/light mode
* refactor: use isDark rather than getContrast
* refactor: change getContrast to isDark with for a more direct approach
* fix: adjust snippet description
* refactor: change getContrast to isDark with for a more direct approach
* fix: adjust snippet description
* fix: TagHero contrast
* fix: DiscussionHero contrast
* fix: newDiscussion contrast
* fix(newDiscussion): restore less rule when tag is not colored
* fix: TagTiles description
* fix: TagTiles last posted
* chore: change `var` to `let`
* refactor: keep it for backwards compatibility
* refactor: keep it for backwards compatibility
* Apply suggestions from code review
* fix: missed this when I was resolving
* fix: remove dist files from pull request
* Revert "Resolved merge conflict"
This reverts commit c7f0d14aa8, reversing
changes made to 6753dfc2af.
* fix: missed this when I was resolving
* fix
* Update isDark.ts
* chore: flexible contrast color fixing
* refactor(isDark): clarify the doc block
* fix(isDark): increase the yiq threshold
* typo
* fix: preserve design coloring through light and dark modes
Co-authored-by: David Wheatley <david@davwheat.dev>
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* fix: check post visibility when mentioning
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* fix: `mentionsPosts` include is not used and leaks private posts
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* chre: use `PostRepository`
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* feat: allow using utf8 characters in slugs
url-encoded slugs are not read by the backend.
* chore: use as a slug driver
* chore: refactor tests to use data provider
* Apply fixes from StyleCI
* fix: wrong resource used
* fix: forgotten slug from slug manager in serializer
* chore(review): adapt tag slug suggestions on the UI
* chore: introduce modes for slugging
* chore: `yarn format`
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* test(subscriptions): approved reply sends out notifications to users
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* feat: send notifications when a post is approved
The code in approval was extracted into a listener because no matter what listeners are always executed before subscribers even if the extension is set to load before.
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* fix: last node in previous data matches first node of current data
* fix: add previous period support for custom periods
* test: update to show previous period for custom range
* wip: group mentions
* Apply fixes from StyleCI
* chore: format
* group mention autocomplete
* chore: format
* remove console.log
* implement notifications
* prevent guest and member groups from being mentioned
* Update extensions/mentions/less/forum.less
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* rename displayname to groupname
* Update extensions/mentions/src/Formatter/FormatGroupMentions.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* remove redundant unparse
* simplify migrations
* add group deleted translation
* Apply fixes from StyleCI
* handle everything falsy
* Include icon in group mention preview
* remove box-shadow from autocomplete group results
* Add color to preview
* chore: format
* Remove box shadow from group autocomplete results
* Update extensions/mentions/migrations/2022_10_21_000000_create_post_mentions_groups_table.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* remove unneeded migration
* prevent former group icon from beingdisplayed
* add group searcher with permissions
* Apply fixes from StyleCI
* Search groups based on canSearchGroups permission
* Don't include virtual groups in results
* Add search groups translation
* Revert "remove unneeded migration"
This reverts commit 9347665baa.
* Revert "Update extensions/mentions/migrations/2022_10_21_000000_create_post_mentions_groups_table.php"
This reverts commit 8406d51df2.
* add searchGroups permission to tests
* Apply fixes from StyleCI
* Add default searchGroups permission
* Apply fixes from StyleCI
* Update extensions/mentions/js/src/forum/addComposerAutocomplete.js
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* Update extensions/mentions/migrations/2022_10_21_000000_create_post_mentions_groups_table.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* remove unneeded migration, correct table table
* correct table name in down migration
* Remove group searcher
* Apply fixes from StyleCI
* Remove group searching from composer autocomplete
* Add mentionGroups permission
* Apply fixes from StyleCI
* prevent post preview from rendering a group mention when user does not have permission
* remove test changes
* wip: expose ServerRequestInterface to textformatter parse()
* Apply fixes from StyleCI
* Set post content properly
* php 7.x compatibility
* begin adding groupmention tests
* Apply fixes from StyleCI
* test virtual groups don't mention
* Apply fixes from StyleCI
* Update framework/core/tests/integration/api/groups/ListTest.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* Update framework/core/tests/integration/api/groups/ListTest.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* Update framework/core/tests/integration/api/groups/ListTest.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* Update framework/core/tests/integration/api/groups/ListTest.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* Update framework/core/tests/integration/api/groups/ListTest.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* Update extensions/mentions/extend.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* Update extensions/mentions/extend.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* requested changes
* Update framework/core/tests/integration/api/groups/ListTest.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* Update framework/core/tests/integration/api/groups/ListTest.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* Update framework/core/src/Search/SearchServiceProvider.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* Update framework/core/src/Extend/Formatter.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* remove default permission migration
* try using datetime column instead of timestamp
* Apply fixes from StyleCI
* chore: remove commented code
* add tests
* Apply fixes from StyleCI
* Pass actor to parser instead of ServerRequest
* Allow for to be null
* Update framework/core/src/Extend/Formatter.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* pass actor instead of request
* Apply fixes from StyleCI
* actor instead of request
* remove serverrequest
* Apply fixes from StyleCI
* remove dupe actor
* Update extensions/mentions/src/Formatter/CheckPermissions.php
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* fix type in comment
* group does not have the relation, post does
* test: invalid, deleted, fresh data mentions
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
* Apply fixes from StyleCI
* fix: group mentions don't work when editing posts
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Co-authored-by: StyleCI Bot <bot@styleci.io>
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
* feat: backend support for statistics custom date ranges
* feat: use seconds-based timestamps on backend instead
* feat: add frontend date selection option
* feat: add tests for lifetime and timed stats
* fix: add error alert when end date is after start date
* fix: wrong label
* fix: no data when start and end date are same day
* fix: use utc dayjs for formatting custom date range on widget
* chore: add dayjs as project dep
* fix: make end date inclusive
* feat: add integration test for custom date period
* fix: incorrect ts expect error comment
* fix: add missing type
* fix: typing errors
* fix(tests): remove type from class attribute definition
* fix: extract default values to function body
* fix: typo
* chore: use small modal
* fix: add missing `FormControl` class
* fix: cast url params to int to enforce type
* chore: `yarn format`
Signed-off-by: Sami Mazouz <sychocouldy@gmail.com>
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
In certain edge cases posts get approved through moderative action and
throws an error when the user has already been deleted.
Ref: DISCUSS-11K on sentry
* test: editing a post with deleted author and mentions
* fix(mentions): accessing `id` of null `user` relation
Signed-off-by: Sami Mazouz <ilyasmazouz@gmail.com>
* feat: Queue package manager commands
* adjust tests
* fix: force run whynot command synchronously
* chore: maximize command output box's height
* chore: more user instructions on background queue
* feat: track command peak memory usage
* feat: exit of CLI php version doesn't match web php version
* chore: install deps
* chore: format and typing workflow fix
Signed-off-by: Sami Mazouz <ilyasmazouz@gmail.com>
* test: list posts with mentions filter and `createdAt` sort
* fix: multiple `createdAt` columns in query causes conflicts
* chore: link to pull request for context
Signed-off-by: Sami Mazouz <ilyasmazouz@gmail.com>
* test: user should only be able to see related tags when allowed
* fix: restricted sibling tags appearing for unauthorized members on the sidebar
* fix: apply logic on tags with parents
* chore: yarn workspaces means we only need a single `yarn.lock`
* fix: add a `cache_dependency_path` workflow input
* fix: re-introduce `env.cache_dependency_path`
With all the commits below, we resolve all outstanding typing issues in the repo, and CI jobs run green.
* fix: Convert DashboardPage and DashboardWidget to TypeScript
* fix: fix type errors in package manager ext
* fix: Convert Post component to TypeScript
* fix: avatar typings should accept null user
* fix: convert Notification component to TypeScript
* fix: properly use `typeof` in ForumApplication
* feat: make Notification content attr generic
* chore: format Notification component
* fix: Convert DiscussionRenamedNotification to TypeScript
* fix(pusher) move shims to a location where they get applied
* fix(pusher): fix some typing errors
* fix(akismet): fix some typing issues
* chore: update core dist typings
* chore(pusher): format
* fix: anchorScroll should accept string selectors
* fix: more accurately represent ApiQueryParamsPlural
* fix: convert PostStreamState to TypeScript
* chore(core): rebuild typings
* feat: allow extending app.routes
* fix: more flexible typings for highlight.ts
* fix: use primitive `number` type for Discussion typings
* fix: convert DiscussionListItem to TypeScript
* chore: rebuild core typings
* fix: final pusher type fixes
* feat: start tags TypeScript conversion
* fix: require-dev tags in pusher for CI TypeScript purposes.
* chore(core): format
* chore(tags): build dist typings
* feat(pusher): use dist types from tags.
* feat: convert flags to TypeScript
* chore(flags): generate dist typings
* fix(akismet): last type errors
* chore: update .yarn-integrity
* chore: partially run flarum-cli audit infra --fix
The tsconfig changes from that command are ignored, since we don't yet support "replacable sections" that would let us add custom config.
* chore: use type imports
* fix: broader gitattributes
* chore: run flarum-cli audit infra --monorepo --fix
* feat: make `app.data` typings extensible
* chore(core): format
* chore: boost tags TypeScript coverage
* fix(tags): further increase type coverage.