Skip to content
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

Added two functions for unread messages in thread #110

Merged
merged 5 commits into from
Feb 25, 2016

Conversation

danbalarin
Copy link
Contributor

#80 #109

Two new functions:
userUnreadMessages($user_id)
userUnreadMessagesCount($user_i

{
$messages = $this->messages()->get();
$participant = $this->getParticipantFromUser($user_id);
if(!$participant)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Expected 1 space after IF keyword; 0 found
  • Inline control structures are not allowed

@cmgmyr
Copy link
Owner

cmgmyr commented Jan 29, 2016

@Kenny11CZ thanks for the PR! I'll take a look at this over the weekend. Can you run this through the PSR2 formatter in the mean time? It would also be helpful to see some tests, but it's not required if you can't and/or don't have time. I can add them in later.

@@ -307,16 +316,16 @@ protected function createSelectString($columns)
switch ($dbDriver) {
case 'pgsql':
case 'sqlite':
$columnString = implode(" || ' ' || " . $tablePrefix . $usersTable . '.', $columns);
$selectString = '(' . $tablePrefix . $usersTable . '.' . $columnString . ') as name';
$columnString = implode(" || ' ' || ".$tablePrefix.$usersTable.'.', $columns);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line indented incorrectly; expected at least 16 spaces, found 12

@danbalarin
Copy link
Contributor Author

So PSR-2 format is done, but i don't know how to do the test... Link me some websites, and I'll look at it.

@antonkomarev
Copy link
Contributor

@Kenny11CZ Something like free video tutorial about unit testing or try to look for others by the word phpunit. Thx for the feature :}

@@ -285,4 +285,61 @@ public function it_should_check_users_and_participants()
$this->assertTrue($thread->hasParticipant(2));
$this->assertFalse($thread->hasParticipant(3));
}

public function it_should_get_all_unread_messages_for_user()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method name EloquentThreadTest::it_should_get_all_unread_messages_for_user is not in camel caps format

@danbalarin
Copy link
Contributor Author

So, I have added tests to QloquentThreadTest file. But i don't have clean laravel instalation so I can't run it... Can someone check it, if it is alright? For today I go sleep, it's 3am and I am very sleepy. gn..

@cmgmyr
Copy link
Owner

cmgmyr commented Feb 14, 2016

@Kenny11CZ can you please run: vendor/bin/php-cs-fixer fix . on your master branch, then commit/push the changes? Looks like there are a number of conflicts because of some formatting.

@danbalarin
Copy link
Contributor Author

Yeeeey, finaly made it merge-able...

@schonhose
Copy link

It would be great to see this merged.

cmgmyr added a commit that referenced this pull request Feb 25, 2016
Added functions for unread messages in thread model
@cmgmyr cmgmyr merged commit 0f22de4 into cmgmyr:master Feb 25, 2016
@cmgmyr
Copy link
Owner

cmgmyr commented Feb 25, 2016

I'm going to merge this in, but I'm going to keep it in master for a while to do some more testing and make some small changes. Thanks again for the PR!

cmgmyr added a commit that referenced this pull request Jun 15, 2016
Added functions for unread messages in thread model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants