Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Discussion Forum Notifications (#2591)
* Basic Notification Schema * Notification Page * Notification Badge on Navigation Page * Using both source and target user_id in Notification table * Mark all as seen * Added href on Notification page * Notification generation, ignore source user * Notification on New/Update to Announcement * Notification autoseen on clicking * Added migrations + enums * Notification on Thread Merging * Minor patch for e2e * Notifications on reply * Notification Badge on Notification button * Removed NOT NULL for from_user_id * Notification as model * Notification button as bell icon * Notification on edit/delete/undelete post or threads * Using Notification Model for DB * Splited switch in handleForum into functions * Test: scroll down in threads list * Changed messages * E2E: Handle infinite scroll and tests * Auto redirect to post * Made listNotifications inline * Renamed type to component * Replaced mb_strimwidth with custom function
- Loading branch information
1 parent
7d6c137
commit 32bdf0e
Showing
14 changed files
with
640 additions
and
29 deletions.
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
25 changes: 25 additions & 0 deletions
25
migration/migrations/course/20180728172250_notifications.py
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,25 @@ | ||
def up(config, conn, semester, course): | ||
with conn.cursor() as cursor: | ||
cursor.execute("DO $$\ | ||
BEGIN\ | ||
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'notifications_component') THEN\ | ||
CREATE TYPE notifications_component AS ENUM ('forum');\ | ||
END IF;\ | ||
END$$;") | ||
cursor.execute("CREATE TABLE IF NOT EXISTS notifications (\ | ||
id serial NOT NULL PRIMARY KEY,\ | ||
component notifications_component NOT NULL,\ | ||
metadata TEXT NOT NULL,\ | ||
content TEXT NOT NULL,\ | ||
from_user_id VARCHAR(255),\ | ||
to_user_id VARCHAR(255) NOT NULL,\ | ||
created_at timestamp with time zone NOT NULL,\ | ||
seen_at timestamp with time zone\ | ||
)") | ||
cursor.execute("ALTER TABLE ONLY notifications DROP CONSTRAINT IF EXISTS notifications_to_user_id_fkey") | ||
cursor.execute("ALTER TABLE ONLY notifications ADD CONSTRAINT notifications_to_user_id_fkey FOREIGN KEY (to_user_id) REFERENCES users(user_id) ON UPDATE CASCADE") | ||
cursor.execute("ALTER TABLE ONLY notifications DROP CONSTRAINT IF EXISTS notifications_from_user_id_fkey") | ||
cursor.execute("ALTER TABLE ONLY notifications ADD CONSTRAINT notifications_from_user_id_fkey FOREIGN KEY (from_user_id) REFERENCES users(user_id) ON UPDATE CASCADE") | ||
|
||
def down(config, conn, semester, course): | ||
pass |
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
Oops, something went wrong.