-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xfmg/init #104
Open
datbth
wants to merge
27
commits into
xfrocks:xenforo2
Choose a base branch
from
datbth:XFMG/init
base: xenforo2
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Xfmg/init #104
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
05136d4
create Controller\Album
datbth 03d53cb
Merge remote-tracking branch 'upstream/xenforo2' into XFMG/init
datbth a9397bc
add actionIndex and actionSingle for albums
datbth 7af96ed
added Api controller for media
datbth e9ac714
include date fields for albums
datbth 109d1e3
add actionPostIndex for media
datbth c081fc3
add data to Transform/MediaItem
datbth 84344a5
fix routing
datbth 111af99
add actionPutIndex for albums
datbth 153a5a3
add actionPostIndex for albums
datbth 475373c
refactor getAttachmentTempHash to not require param attachment_hash
datbth 1501ad1
add actionPutIndex for media
datbth c66accb
add actionDeleteIndex for albums
datbth 227980a
add some filters for album listing
datbth 08c7e5d
add actionDeleteIndex for media
datbth 9a93e43
remove unnecessary detachEntity in album controller
datbth e4cccd9
refactor controllers
datbth fa936f4
fix AbstractController
datbth d853811
add like actions for album
datbth cb7f4a3
add like actions for media
datbth 638f7a1
add is_liked field to Transform\Album and Transform\Media
datbth a3d27f3
implement follow APIs for albums
datbth 0ef09b1
implement follow APIs for media
datbth 09979fe
add links to API response for album and media
datbth da7a602
add permissions data to API response for albums and media
datbth 9bbccf1
add basic APIs for comments
datbth 30af829
revert changes in _output/templates/_metadata.json
datbth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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,81 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: datbth | ||
* Date: 05/12/2018 | ||
* Time: 21:39 | ||
*/ | ||
|
||
namespace Xfrocks\Api\XFMG\Controller; | ||
|
||
abstract class AbstractController extends \Xfrocks\Api\Controller\AbstractController | ||
{ | ||
/** | ||
* @param int $albumId | ||
* @param array $extraWith | ||
* @return \XFMG\Entity\Album | ||
* @throws \XF\Mvc\Reply\Exception | ||
*/ | ||
protected function assertViewableAlbum($albumId, array $extraWith = []) | ||
{ | ||
/** @var \XFMG\Entity\Album $album */ | ||
$album = $this->assertRecordExists( | ||
'XFMG:Album', | ||
$albumId, | ||
$extraWith, | ||
'xfmg_requested_album_not_found' | ||
); | ||
|
||
if (!$album->canView($error)) { | ||
throw $this->exception($this->noPermission($error)); | ||
} | ||
|
||
return $album; | ||
} | ||
|
||
/** | ||
* @param int $categoryId | ||
* @param array $extraWith | ||
* @return \XFMG\Entity\Category | ||
* @throws \XF\Mvc\Reply\Exception | ||
*/ | ||
protected function assertViewableCategory($categoryId, array $extraWith = []) | ||
{ | ||
/** @var \XFMG\Entity\Category $category */ | ||
$category = $this->assertRecordExists( | ||
'XFMG:Category', | ||
$categoryId, | ||
$extraWith, | ||
'xfmg_requested_category_not_found' | ||
); | ||
|
||
if (!$category->canView($error)) { | ||
throw $this->exception($this->noPermission($error)); | ||
} | ||
|
||
return $category; | ||
} | ||
|
||
/** | ||
* @param int $mediaId | ||
* @param array $extraWith | ||
* @return \XFMG\Entity\MediaItem | ||
* @throws \XF\Mvc\Reply\Exception | ||
*/ | ||
protected function assertViewableMediaItem($mediaId, array $extraWith = []) | ||
{ | ||
/** @var \XFMG\Entity\MediaItem $item */ | ||
$item = $this->assertRecordExists( | ||
'XFMG:MediaItem', | ||
$mediaId, | ||
$extraWith, | ||
'xfmg_requested_media_item_not_found' | ||
); | ||
|
||
if (!$item->canView($error)) { | ||
throw $this->exception($this->noPermission($error)); | ||
} | ||
|
||
return $item; | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tại sao cần implement cái này nhỉ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dạ bên
POST /media
lưu file thành attachment nhưng không respond cái attachment nên em tách ra cái functiondoUpload
riêngThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
À hiểu rồi. Thôi như đã bàn thì cứ để nó upload riêng và save riêng nha.