1
0
mirror of https://github.com/flarum/core.git synced 2025-09-02 12:43:28 +02:00
Commit Graph

8723 Commits

Author SHA1 Message Date
Clark Winkelmann
8835aee224 Assert permission when updating avatar 2018-01-31 16:36:42 +01:00
Toby Zerner
c4b8875be2 Don't break compatibility with extensions that return a function name
eg. s9e/mediaembed
2018-01-31 07:20:49 +10:30
Toby Zerner
eb36d98b82 Don't need to make empty discussions visible anymore
As per flarum/core@557a65aadd
2018-01-30 11:16:10 +10:30
Toby Zerner
4af6acdbda Grant users permission to view empty discussions if they can edit posts
This fixes an issue where unapproved discussions (via
flarum-ext-approval) that were rejected became invisible to the user.

This solution is imperfect and some more substantial thought into how
flarum-ext-approval works is required in the future.
2018-01-30 11:14:25 +10:30
Toby Zerner
b5eab781f1 Overhaul model visibility scoping (#1342)
* Overhaul the way model visibility scoping works

- Previously post visibility scoping required concrete knowledge of the
  parent discussion, ie. you needed a Discussion model on which you
  would call `postsVisibleTo($actor)`. This meant that to fetch posts
  from different discussions (eg. when listing user posts), it was a
  convoluted process, ultimately causing #1333.

  Now posts behave like any other model in terms of visibility scoping,
  and you simply call `whereVisibleTo($actor)` on a Post query. This
  scope will automatically apply a WHERE EXISTS clause that scopes the
  query to only include posts whose discussions are visible too. Thus,
  fetching posts from multiple discussions can now be done in a single
  query, simplifying things greatly and fixing #1333.

- As such, the ScopePostVisibility event has been removed. Also, the
  rest of the "Scope" events have been consolidated into a single event,
  ScopeModelVisibility. This event is called whenever a user must have
  a certain $ability in order to see a set of discussions. Typically
  this ability is just "view". But in the case of discussions which have
  been marked as `is_private`, it is "viewPrivate". And in the case of
  discussions which have been hidden, it is "hide". etc.

  The relevant API on AbstractPolicy has been refined, now providing
  `find`, `findPrivate`, `findEmpty`, and `findWithPermission` methods.
  This could probably do with further refinement and we can re-address
  it once we get around to implementing more Extenders.

- An additional change is that Discussion::comments() (the relation
  used to calculate the cached number of replies) now yields "comments
  that are not private", where before it meant "comments that are
  visible to Guests". This was flawed because eg. comments in non-public
  tags are technically not visible to Guests.

  Consequently, the Approval extension must adopt usage of `is_private`,
  so that posts which are not approved are not included in the replies
  count. Fundamentally, `is_private` now indicates that a discussion/
  post should be hidden by default and should only be visible if it
  meets certain criteria. This is in comparison to non-is_private
  entities, which are visible by default and may be hidden if they don't
  meet certain criteria.

Note that these changes have not been extensively tested, but I have
been over the logic multiple times and it seems to check out.

* Add event to determine whether a discussion `is_private`

See https://github.com/flarum/core/pull/1153#issuecomment-292693624

* Don't include hidden posts in the comments count

* Apply fixes from StyleCI (#1350)
2018-01-27 09:57:16 +10:30
Toby Zerner
8060bb78ac Merge branch 'master' into visibility-scoping 2018-01-27 09:26:14 +10:30
Toby Zerner
b34f978276 Merge branch 'master' into visibility-scoping 2018-01-27 09:07:49 +10:30
Franz Liedke
5d76cf8e55 Convert closures in arrays to Compat extenders as well
Refs #851.
2018-01-21 22:38:06 +01:00
Franz Liedke
5d5cec3914 Import extend namspace 2018-01-21 22:20:58 +01:00
Franz Liedke
57bb2e17b5 Use cursor() fetching when deleting many posts
Refs #1319.
2018-01-21 21:53:48 +01:00
Franz Liedke
ac04b6ada5 Assets extender: Remove defaultAssets() method
See a7821a24a2 (r26990974).
2018-01-21 21:14:08 +01:00
Franz Liedke
b1ed9d4d1d Extender: List all assets explicitly 2018-01-21 21:11:06 +01:00
Franz Liedke
333bb702ed Extender: List all assets explicitly 2018-01-21 21:10:56 +01:00
Franz Liedke
99c172b2b4 Extender: List all assets explicitly 2018-01-21 21:10:41 +01:00
Franz Liedke
4c8bea217b Extender: List all assets explicitly 2018-01-21 21:10:26 +01:00
Franz Liedke
bb92a80585 Extender: List all assets explicitly 2018-01-21 21:10:05 +01:00
Franz Liedke
c25b8e1510 Extender: List all assets explicitly 2018-01-21 21:09:52 +01:00
Franz Liedke
85fa190f59 Extender: List all assets explicitly 2018-01-21 21:09:37 +01:00
Franz Liedke
8cbceb8d96 Extender: List all assets explicitly 2018-01-21 21:09:27 +01:00
Franz Liedke
da075a3d0f Extender: List all assets explicitly 2018-01-21 21:09:16 +01:00
Franz Liedke
22885b7796 Extender: List all assets explicitly 2018-01-21 21:09:04 +01:00
Franz Liedke
324140d2e6 Extender: List all assets explicitly 2018-01-21 21:07:58 +01:00
Toby Zerner
ac664907cc Remove old event listener 2018-01-21 09:13:08 +10:30
Toby Zerner
f559c9a651 Merge branch 'master' into visibility-scoping
# Conflicts:
#	bootstrap.php
2018-01-21 08:36:02 +10:30
Toby Zerner
a390f7ca1b Make sure the discussion is_approved attribute value is correct 2018-01-21 08:34:33 +10:30
Toby Zerner
e8103ad0b3 Fix query errors 2018-01-21 08:33:45 +10:30
Toby Zerner
b1ea9aa4ee Fix docblocks 2018-01-21 08:28:15 +10:30
Toby Zerner
ee8d7c63cd Fix Laravel 5.5 query scoping 2018-01-21 08:28:08 +10:30
Franz Liedke
ad07d7570f Fix order of imports 2018-01-17 08:27:57 +01:00
Franz Liedke
30e21bb37d Remove unused import 2018-01-17 08:27:19 +01:00
Franz Liedke
ee07f29d5a Adapt new bootstrap format, use Asset extender 2018-01-16 23:27:32 +01:00
Franz Liedke
5cb1fc4627 Adapt new bootstrap format, use Asset extender 2018-01-16 23:24:34 +01:00
Franz Liedke
dd9907a26b Adapt new bootstrap format, use Asset extender 2018-01-16 23:20:25 +01:00
Franz Liedke
9c6ef9e043 Adapt new bootstrap format, use Asset extender 2018-01-16 23:20:02 +01:00
Franz Liedke
a4c42dcfff Adapt new bootstrap format, use Asset extender 2018-01-16 23:19:29 +01:00
Franz Liedke
b7991afbbb Adapt new bootstrap format, use Asset extender 2018-01-16 23:19:16 +01:00
Franz Liedke
918ca2201d Adapt new bootstrap format, use Asset extender 2018-01-16 23:18:41 +01:00
Franz Liedke
88826fa9ae Adapt new bootstrap format, use Asset extender 2018-01-16 23:18:30 +01:00
Franz Liedke
95f70cae7a Adapt new bootstrap format, use Asset extender 2018-01-16 23:18:17 +01:00
Franz Liedke
7435d18940 Adapt new bootstrap format, use Asset extender 2018-01-16 23:17:47 +01:00
Franz Liedke
ac01d40b9a Adapt new bootstrap format, use Asset extender 2018-01-16 23:17:23 +01:00
Toby Zerner
67f949a2cb Merge pull request #6 from milescellar/patch-2
Update license year range to 2018
2018-01-16 15:31:24 +10:30
Toby Zerner
51fc730082 Merge pull request #5 from milescellar/patch-1
Update license year range to 2018
2018-01-16 15:31:20 +10:30
Toby Zerner
6edcd3159c Merge pull request #14 from milescellar/patch-1
Update license year range to 2018
2018-01-16 15:31:16 +10:30
Toby Zerner
8c5d5763a2 Merge pull request #116 from milescellar/patch-5
Update license year range to 2018
2018-01-16 15:31:11 +10:30
Toby Zerner
48c8b8907a Merge pull request #13 from milescellar/patch-1
Update license year range to 2018
2018-01-16 15:31:07 +10:30
Toby Zerner
0462ff30cb Merge pull request #11 from milescellar/patch-1
Update license year range to 2018
2018-01-16 15:31:00 +10:30
Toby Zerner
abb74c3378 Merge pull request #5 from milescellar/patch-1
Update license year range to 2018
2018-01-16 15:30:56 +10:30
Toby Zerner
947abe6cde Merge pull request #29 from milescellar/patch-1
Update license year range to 2018
2018-01-16 15:30:52 +10:30
Toby Zerner
382567e833 Merge pull request #13 from milescellar/patch-1
Update license year range to 2018
2018-01-16 15:30:48 +10:30