Sei sulla pagina 1di 9

Requirements

1. Register an account
2. 140 characters post
3. Follow other user
4. Retweet other posts

Three Users

1. Admin
2. Guest
3. User
Functionalities

Admin

Scope

Users

1. Create users
a. Can assign role
b. Can create password – (!message password to email)
2. Edit users profile
3. View users profile
4. View users info (Profile) with default picture
a. Lists user posts with comments
i. Own post – edit and delete
ii. Own comment – edit and delete
b. Show followers
c. Show following
d. Verified account if followed by admin with ID of 1
5. Activate/Deactivate user account
6. Search user via DataTables

Posts

1. View list of posts


2. Publish/unpublish posts
3. Reset views
4. Edit posts
5. Delete posts
6. Search post via DataTables

Timeline

1. Browse posts
2. See mentioned users

Categories

1. Category frequencies

Limitations

1. Search on users UI
2. Update profile picture
User

Scope

1. View posts
2. Follow user
3. Unfollower user
4. Once the user is follow, you can now see their posts
5. Add posts – need to published before display
6. Can post with pictures
7. Can reposts
8. Can edit post

Limitations

1. Search

Guest

Scope

1. View list of posts


2. View specific post
3. //Can add comment
4. View popular posts
5. Browse posts via categories
6. Can register
7. Cannot login if not registered/email verified
8. Need to activate before logging in

Limitations

1. Unable to add guest comment

Rules

1. After signing it, you will be automatically followed by yourself, but hidden

Restrictions

1. Needs approval of comment if is not the owner of the post


Limitations

1. Search
2. Suggests to follow users
3. Doesn’t have outdate status for popular posts
Liked

Learned

Lacked

1. differentiation of admin and user

2. echoing of queried model

Longed for
Bugs found:

1. Posts deleted will result an error if accessed through URL - Fixed


2. Guest comment resulted “Unable to post a comment”
3. Unknown “aaaa” category
4. Alphanumeric validation was removed during user registration
5. Update profile picture is still underdeveloped
6. No edit for posts category
7. Post body on users profile, is repeating - Fixed
8. Has the “health” category on users profile page - Fixed
9. Post views, doesn’t increment - Fixed
10. UpdateAll active status doesn’t change after verifying email
11. Shows comment box when logged out – Fixed
12. Followers
13. Delete posts from admin side
14. Optimization

Code Review

Common:

Add Comment before the function for documentaion

remove ?> tags in all controller

use this array style : []

not this: array()

remove comment that is not descriptive or not part of the file

ex:

FollowersController: what is this function do

public function follow($username = null) {

AppController

line 18 :remove comment that is not descriptive or not part of the file

CronController : remove this file if not use


FollowersController:

use correction spelling in SetFlash

line

26/44: $this->Session->SetFlash('Followed user', 'success');

line

59/77: remove this set compact

PasswordsTokensController:

line 24: make this dynamic http://cakeblog.com

PostsController

line:

24:

Make 1 query for this Post Model and get all fields that you want
to get

$post = $this->Post->findById($id);

$count = $this->Post->field('views', array('Post.id' =>


$id));

$title = $this->Post->field('title', array('Post.id' =>


$id));

$authUser = AuthComponent::user('id');

$count = $this->Post->find('count', array('conditions' =>


array('Post.id' => $id)));

$reposted = $this->Post->field('id', array('Post.post_id' =>


$id, 'user_id' => AuthComponent::user('id')

53: make this OR statement

if (!$id) {

throw new NotFoundException(__('Invalid post'));


}

if (!$post) {

throw new NotFoundException(__('Invalid post'));

91:

make this descriptive $cat_

106:

what is the purpose of doing this?

$this->Post->hasAndBelongsToMany['Category']['unique'] = false;

160:

add spacing $this->layout="user";

214:

why there is die() function

pr($this->fullname);

die();

290:

use single quote 'user'

$this->layout = "user";

327:

always add exception or condition if parameter is not given

public function repost($postid) {

RepostsController

what is this controller

UsersController

line

27: Make this in OR statement

if (!$id) {
throw new NotFoundException(__('Invalid user'));

$user = $this->User->findById($id);

if (!$user) {

throw new NotFoundException(__('Invalid user'));

185:

don't do this format add brackets

if ($follower != 0) : $finalfollower = $follower - 1; endif;

if ($following != 0) : $finalfollowing = $follower - 1;


endif;

Model

remove comment that is not descriptive or not part of the file

Views:

so far you added h() in data came from controller which is good

but I think no need to put h($data['Post']['id']) in primary keys or


numbers

and add translation function in static text

changet this

ex: <h1> User Profile </h1>

to: <h1> <?php echo __('User Profile'); ?> </h1>

Potrebbero piacerti anche