Skip to content
This repository has been archived by the owner on May 20, 2023. It is now read-only.

#9 notify user on new messages #26

Merged
merged 3 commits into from
Jun 15, 2019
Merged

#9 notify user on new messages #26

merged 3 commits into from
Jun 15, 2019

Conversation

olenagerasimova
Copy link
Contributor

For #9:

  • created interface to send notifications
  • implementation to send info to user's telegram chat
  • added new method to User to get user telegram id
  • todo to continue

@0crat
Copy link

0crat commented Jun 10, 2019

Job #26 is now in scope, role is REV

@0crat
Copy link

0crat commented Jun 10, 2019

This pull request #26 is assigned to @victornoel/z, here is why; the budget is 15 minutes, see §4; please, read §27 and when you decide to accept the changes, inform @g4s8/z (the architect) right in this ticket; if you decide that this PR should not be accepted ever, also inform the architect; this blog post will help you understand what is expected from a code reviewer; there will be no monetary reward for this job

Copy link
Contributor

@victornoel victornoel left a comment

Choose a reason for hiding this comment

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

@olenagerasimova some comments

* create a class to extract and format this information from `JsonObject`
* (github subject) accordingly.
*/
class UnreadThreads implements Notification {
Copy link
Contributor

Choose a reason for hiding this comment

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

@olenagerasimova class should be final

* @todo #9:30 Continue implement notifications for user when new messages
* (unread github notification) arrive. Unread msgs can be retrieved with
* the help of PgThreads#unread() method, and this class is meant to sent
* them to tlg chat. So set up whole mechanism together.
Copy link
Contributor

Choose a reason for hiding this comment

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

@olenagerasimova I'm not clear what is the next step here:

  • what is meant to be using Notification?
  • where is UnreadThreads meant to be instantiated?

Can you elaborate a bit better on what you had in mind when you introduced those abstractions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@victornoel Notification mission is simple - send message (in our case - to telegram chat), and UnreadThreads implementation does that - it sends telegram messages to all given users about all given github threads.

So, now it's necessary to monitor unread notification by periodically checking threads table for unread threads. Saying more practical, the whole idea is to schedule java thread (or any other synchronization process) to periodically call PgThreads#unread() to retrieve unread messages and Notification.UnreadThreads to send them.

Do you get the idea now? Or smth is still not clear?

Copy link
Contributor

Choose a reason for hiding this comment

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

@olenagerasimova I do understand now, could you reword the todo to explain it?

* @param users Users
*/
public UnreadThreads(final BotSimple bot,
final Map<Long, List<Thread>> ntfc, final Users users) {
Copy link
Contributor

Choose a reason for hiding this comment

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

@olenagerasimova why doesn't this notification directly takes PgThreads and call unreads() itself when send() is called? It would be more OO (even though I'm not sure what you had in mind).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@victornoel I do not like the idea of passing PgThreads to this class, because PgThreads does not implement any interface. Now it's a class that depends on database source and we definitely do not want deal with it in unit tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

@olenagerasimova good point. Maybe @g4s8 you have an opinion if a todo should be added for introducing an interface for PgThreads or not?

Copy link
Owner

Choose a reason for hiding this comment

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

@victornoel I think we can merge this part now, but you can submit a ticket with refactoring suggestion if you see how to make it better

Copy link
Contributor

Choose a reason for hiding this comment

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

@g4s8 yes, it's maybe too early to know what is the best course of action anyway :)

* https://github.com/g4s8/teletakes/issues/14 is resolved. Please, try to
* avoid using mocked objects, use fake implementations instead.
*/
public class UnreadThreadsTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

@olenagerasimova class should be final and maybe it is best to keep this todo with UnreadThreads instead of introducing this empty file.

@olenagerasimova
Copy link
Contributor Author

@victornoel thanks for review, please, take one more look

@olenagerasimova
Copy link
Contributor Author

@victornoel ping

*
* @since 1.0
*/
package com.g4s8.ghman.bot;
Copy link
Contributor

Choose a reason for hiding this comment

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

@olenagerasimova I believe this file is not needed anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@victornoel right now - no, but I really hope we will have tests for bot package soon and I do not see what is wrong with having empty (yet) test package. I've removed it though.

Copy link
Contributor

Choose a reason for hiding this comment

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

@olenagerasimova it's better for consistency of the PR

@olenagerasimova
Copy link
Contributor Author

@victornoel empty package removed, please, take a look

@victornoel
Copy link
Contributor

@olenagerasimova thanks

@g4s8 I think it's ok now

@g4s8
Copy link
Owner

g4s8 commented Jun 15, 2019

@rultor merge

@rultor
Copy link
Contributor

rultor commented Jun 15, 2019

@rultor merge

@g4s8 OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 707d180 into g4s8:master Jun 15, 2019
@rultor
Copy link
Contributor

rultor commented Jun 15, 2019

@rultor merge

@g4s8 Done! FYI, the full log is here (took me 2min)

@0crat
Copy link

0crat commented Jun 15, 2019

Job #26 is not in the agenda of @victornoel/z, can't inspect

@0crat 0crat removed the scope label Jun 15, 2019
@0crat
Copy link

0crat commented Jun 15, 2019

@ammaratef45/z please review this job completed by @victornoel/z, as in §30; the job will be fully closed and all payments will be made when the quality review is completed

@0crat
Copy link

0crat commented Jun 15, 2019

The job #26 is now out of scope

@0crat
Copy link

0crat commented Jun 15, 2019

Payment to ARC for a closed pull request, as in §28: +10 point(s) just awarded to @g4s8/z

@ammaratef45
Copy link

@0crat quality good

@0crat
Copy link

0crat commented Jun 16, 2019

Order was finished, quality is "good": +20 point(s) just awarded to @victornoel/z

@0crat
Copy link

0crat commented Jun 16, 2019

Quality review completed: +4 point(s) just awarded to @ammaratef45/z

@0pdd
Copy link

0pdd commented Jul 19, 2019

@olenagerasimova the puzzle #74 is still not solved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants