#507 update updates2stable
Merged 6 years ago by abompard. Opened 6 years ago by ryanlerch.
ryanlerch/fedora-hubs updates2stable  into  develop

@@ -19,15 +19,7 @@ 

      label = 'Updates Ready for Stable'

      position = "right"

      hidden_if_empty = True

-     parameters = [

-         dict(

-             name="username",

-             label="Username",

-             default=None,

-             validator=validators.Username,

-             help="A FAS username.",

-         )]

- 

+     hub_types = ['stream']

  

  class BaseView(RootWidgetView):

  
@@ -36,7 +28,7 @@ 

      def get_context(self, instance, *args, **kwargs):

          get_pending = GetPending(instance)

          context = dict(

-             username=instance.config["username"],

+             username = instance.hub.name,

              )

          context.update(get_pending())

          return context
@@ -51,7 +43,7 @@ 

  class GetPending(CachedFunction):

  

      def execute(self):

-         username = self.instance.config["username"]

+         username = self.instance.hub.name

          # First, get all of my updates currently in testing.

          bodhiurl = 'https://bodhi.fedoraproject.org/updates/'

          query = '?user={username}&status=testing'.format(username=username)
@@ -88,7 +80,7 @@ 

          if not message['topic'].endswith('bodhi.update.comment'):

              return False

          if giveaway in message['msg']['comment']['text']:

-             username = self.instance.config['username']

+             username = self.instance.hub.name

              if username == message['msg']['comment']['update_submitter']:

                  return True

          return False

make updates2stable only show on stream page, and
link it to the user of the stream, rather than a
config value.

Do you think it's better to have it show "no updates ready for stable" rather than just not show the widget at all? I thought it would be more practical if widgets who have nothing to say don't clutter up the page, it would allow adding more widgets even if they are rarely useful.

I'm probably not the best person to ask about UX stuff. Hiding it when it has nothing to say sounds interesting enough though. @ryanlerch what do you think?

@abompard for me it felt a little strange to completely hide the widget -- i at first thought it was a bug when I added the widget, and then it wasnt appearing in the UI. I only figured out that this was expected behaviour after looking at the code.

I wonder if @mizmo has any thoughts on this one.

THe two behaviours being discussed here are:

  1. Always show the widget, even if there is no results for the query the widget does, and then just show a "no results" message,

or

  1. Silently not show the widget if there are no results to show in the widget.

rebased onto 7252b22

6 years ago

Since this widget was previously doing the hiding functionality, i have reverted that part of my patch, and now this patch just rescrticts this widget to the stream page, and uses the user's name as the parameter.

I have filed this issue to discuss the hiding / not hiding of widgets:

https://pagure.io/fedora-hubs/issue/512

cheers,
ryanlerch

Pull-Request has been merged by abompard

6 years ago
Metadata