mirror of
https://github.com/tubearchivist/tubearchivist-frontend.git
synced 2024-11-22 20:00:15 +00:00
userspace hide_watched in home and channelid view
This commit is contained in:
parent
180a63d6dd
commit
ef13b9259e
@ -135,7 +135,8 @@ class HomeView(View):
|
|||||||
if sort_order == {"status": False}:
|
if sort_order == {"status": False}:
|
||||||
sort_order = "desc"
|
sort_order = "desc"
|
||||||
|
|
||||||
hide_watched = RedisArchivist().get_message("hide_watched")
|
hide_watched_key = f"{user_id}:hide_watched"
|
||||||
|
hide_watched = RedisArchivist().get_message(hide_watched_key)["status"]
|
||||||
view_config = {
|
view_config = {
|
||||||
"colors": colors,
|
"colors": colors,
|
||||||
"view_style": view_style,
|
"view_style": view_style,
|
||||||
@ -329,7 +330,7 @@ class ChannelIdView(View):
|
|||||||
def get(self, request, channel_id_detail):
|
def get(self, request, channel_id_detail):
|
||||||
"""get method"""
|
"""get method"""
|
||||||
# es_url, colors, view_style = self.read_config()
|
# es_url, colors, view_style = self.read_config()
|
||||||
view_config = self.read_config()
|
view_config = self.read_config(user_id=request.user.id)
|
||||||
context = self.get_channel_videos(
|
context = self.get_channel_videos(
|
||||||
request, channel_id_detail, view_config
|
request, channel_id_detail, view_config
|
||||||
)
|
)
|
||||||
@ -337,7 +338,7 @@ class ChannelIdView(View):
|
|||||||
return render(request, "home/channel_id.html", context)
|
return render(request, "home/channel_id.html", context)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read_config():
|
def read_config(user_id):
|
||||||
"""read config file"""
|
"""read config file"""
|
||||||
config = AppConfig().config
|
config = AppConfig().config
|
||||||
|
|
||||||
@ -347,7 +348,8 @@ class ChannelIdView(View):
|
|||||||
sort_order = RedisArchivist().get_message("sort_order")
|
sort_order = RedisArchivist().get_message("sort_order")
|
||||||
if sort_order == {"status": False}:
|
if sort_order == {"status": False}:
|
||||||
sort_order = "desc"
|
sort_order = "desc"
|
||||||
hide_watched = RedisArchivist().get_message("hide_watched")
|
hide_watched_key = f"{user_id}:hide_watched"
|
||||||
|
hide_watched = RedisArchivist().get_message(hide_watched_key)["status"]
|
||||||
|
|
||||||
view_config = {
|
view_config = {
|
||||||
"colors": config["application"]["colors"],
|
"colors": config["application"]["colors"],
|
||||||
@ -770,18 +772,17 @@ class PostData:
|
|||||||
|
|
||||||
def hide_watched(self):
|
def hide_watched(self):
|
||||||
"""toggle if to show watched vids or not"""
|
"""toggle if to show watched vids or not"""
|
||||||
hide_watched = bool(int(self.exec_val))
|
key = f"{self.current_user}:hide_watched"
|
||||||
print(f"hide watched: {hide_watched}")
|
message = {"status": bool(int(self.exec_val))}
|
||||||
RedisArchivist().set_message(
|
print(f"toggle {key}: {message}")
|
||||||
"hide_watched", hide_watched, expire=False
|
RedisArchivist().set_message(key, message, expire=False)
|
||||||
)
|
|
||||||
return {"success": True}
|
return {"success": True}
|
||||||
|
|
||||||
def show_subed_only(self):
|
def show_subed_only(self):
|
||||||
"""show or hide subscribed channels only on channels page"""
|
"""show or hide subscribed channels only on channels page"""
|
||||||
key = f"{self.current_user}:show_subed_only"
|
key = f"{self.current_user}:show_subed_only"
|
||||||
message = {"status": bool(int(self.exec_val))}
|
message = {"status": bool(int(self.exec_val))}
|
||||||
print(f"show {key}: {message}")
|
print(f"toggle {key}: {message}")
|
||||||
RedisArchivist().set_message(key, message, expire=False)
|
RedisArchivist().set_message(key, message, expire=False)
|
||||||
return {"success": True}
|
return {"success": True}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user